mirror of
https://github.com/docmost/docmost
synced 2025-03-28 21:13:28 +00:00
Option to log db queries in dev mode (#827)
This commit is contained in:
parent
8826cca539
commit
05a3dfa26d
@ -46,12 +46,15 @@ types.setTypeParser(types.builtins.INT8, (val) => Number(val));
|
|||||||
plugins: [new CamelCasePlugin()],
|
plugins: [new CamelCasePlugin()],
|
||||||
log: (event: LogEvent) => {
|
log: (event: LogEvent) => {
|
||||||
if (environmentService.getNodeEnv() !== 'development') return;
|
if (environmentService.getNodeEnv() !== 'development') return;
|
||||||
|
const logger = new Logger(DatabaseModule.name);
|
||||||
if (event.level === 'query') {
|
if (event.level === 'query') {
|
||||||
// console.log(event.query.sql);
|
if (process.env.DEBUG_DB?.toLowerCase() === 'true') {
|
||||||
//if (event.query.parameters.length > 0) {
|
logger.debug(event.query.sql);
|
||||||
//console.log('parameters: ' + event.query.parameters);
|
logger.debug('query time: ' + event.queryDurationMillis + ' ms');
|
||||||
//}
|
//if (event.query.parameters.length > 0) {
|
||||||
// console.log('time: ' + event.queryDurationMillis);
|
// logger.debug('parameters: ' + event.query.parameters);
|
||||||
|
//}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user