mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
debug: log query counts based on operation and table
This commit is contained in:
parent
94b21287ad
commit
0064d8fe3e
4 changed files with 40 additions and 11 deletions
|
@ -1,5 +1,7 @@
|
|||
import { Connection, createConnection } from "typeorm";
|
||||
import { SimpleError } from "../SimpleError";
|
||||
import connectionOptions from "../../ormconfig";
|
||||
import { QueryLogger } from "./queryLogger";
|
||||
|
||||
let connectionPromise: Promise<Connection>;
|
||||
|
||||
|
@ -7,7 +9,11 @@ export let connection: Connection;
|
|||
|
||||
export function connect() {
|
||||
if (!connectionPromise) {
|
||||
connectionPromise = createConnection().then((newConnection) => {
|
||||
connectionPromise = createConnection({
|
||||
...(connectionOptions as any),
|
||||
logging: ["query", "error"],
|
||||
logger: new QueryLogger(),
|
||||
}).then((newConnection) => {
|
||||
// Verify the DB timezone is set to UTC
|
||||
return newConnection.query("SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP) AS tz").then((r) => {
|
||||
if (r[0].tz !== "00:00:00") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue