2
0
forked from jmug/cactoide

fix: custom log level error

This commit is contained in:
Levente Orban
2025-11-08 11:24:29 +01:00
parent 406a669a98
commit 0ecaf54227
2 changed files with 18 additions and 7 deletions

View File

@@ -1,6 +1,16 @@
import pino from 'pino';
import { LOG_PRETTY, LOG_LEVEL } from '$env/static/private';
try {
if (LOG_PRETTY && LOG_LEVEL) {
console.debug(
`Initializing logger with pretty logs: LOG_PRETTY: ${LOG_PRETTY} and LOG_LEVEL: ${LOG_LEVEL}`
);
}
} catch (error) {
console.error('Error initializing logger', error);
}
const USE_PRETTY_LOGS = LOG_PRETTY === 'true';
const transport = USE_PRETTY_LOGS
@@ -10,6 +20,14 @@ const transport = USE_PRETTY_LOGS
colorize: true,
translateTime: 'SYS:standard',
ignore: 'pid,hostname'
},
customLevels: {
trace: 10,
debug: 20,
info: 30,
warn: 40,
error: 50,
fatal: 60
}
}
: undefined;