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()],
|
||||
log: (event: LogEvent) => {
|
||||
if (environmentService.getNodeEnv() !== 'development') return;
|
||||
const logger = new Logger(DatabaseModule.name);
|
||||
if (event.level === 'query') {
|
||||
// console.log(event.query.sql);
|
||||
//if (event.query.parameters.length > 0) {
|
||||
//console.log('parameters: ' + event.query.parameters);
|
||||
//}
|
||||
// console.log('time: ' + event.queryDurationMillis);
|
||||
if (process.env.DEBUG_DB?.toLowerCase() === 'true') {
|
||||
logger.debug(event.query.sql);
|
||||
logger.debug('query time: ' + event.queryDurationMillis + ' ms');
|
||||
//if (event.query.parameters.length > 0) {
|
||||
// logger.debug('parameters: ' + event.query.parameters);
|
||||
//}
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
|
Loading…
x
Reference in New Issue
Block a user