export = KnexLogger; /** * @typedef {object} LoggerOptions * @prop {Knex} pool * @prop {number} logDurationsAboveMs - Queries lasting longer than the specified * duration are logged; 0 means log all queries * @prop {cutDurationsOverMs} - Queries lasting longer than this value are * logged and not not monitored any more * @prop {'info'|'warn'|'error'} [logLevel] - Log method to be used (defaults * to warn) * in tests) */ /** * @typedef {object} KnexLoggerConfig * @prop {Knex} pool * @prop {object} [log] - console or another logger (defaults to console) * @prop {LoggerOptions} options * @prop {Function} [setTimeout] - method for setTimeout (overridden in tests) * @prop {Function} [getTimeMs] - method returning unix time in ms (overridden * in tests) */ declare class KnexLogger { /** * @prop {object[]} */ static "__#2@#queries": {}; /** * @prop {number} */ static "__#2@#timeoutDelayMs": number; /** * @param {KnexLoggerConfig} config */ constructor(config: KnexLoggerConfig); /** * @returns {KnexLogger} */ start(): KnexLogger; cleanup(): void; #private; } declare namespace KnexLogger { export { LoggerOptions, KnexLoggerConfig }; } type LoggerOptions = { pool: Knex; /** * - Queries lasting longer than the specified * duration are logged; 0 means log all queries */ logDurationsAboveMs: number; /** * - Queries lasting longer than this value are * logged and not not monitored any more */ "": cutDurationsOverMs; /** * - Log method to be used (defaults * to warn) * in tests) */ logLevel?: "error" | "info" | "warn" | undefined; }; type KnexLoggerConfig = { pool: Knex; /** * - console or another logger (defaults to console) */ log?: object | undefined; options: LoggerOptions; /** * - method for setTimeout (overridden in tests) */ setTimeout?: Function | undefined; /** * - method returning unix time in ms (overridden * in tests) */ getTimeMs?: Function | undefined; };