mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
28 lines
548 B
JavaScript
28 lines
548 B
JavaScript
const pino = require('pino')
|
|
|
|
const PinoLevelToSeverityLookup = {
|
|
trace: 'DEBUG',
|
|
debug: 'DEBUG',
|
|
info: 'INFO',
|
|
warn: 'WARNING',
|
|
error: 'ERROR',
|
|
fatal: 'CRITICAL',
|
|
};
|
|
|
|
const logger = defaultConfig =>
|
|
pino({
|
|
...defaultConfig,
|
|
messageKey: 'message',
|
|
formatters: {
|
|
level(label, number) {
|
|
return {
|
|
severity: PinoLevelToSeverityLookup[label] || PinoLevelToSeverityLookup['info'],
|
|
level: number,
|
|
}
|
|
},},
|
|
mixin: () => ({ name: 'custom-pino-instance' }),
|
|
})
|
|
|
|
module.exports = {
|
|
logger,
|
|
} |