-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Hi,
How do I use this module? I can't make much sense from the doc. This is my logger setup. Right now, I only can see the error message in the console. But stack trace is not there.
const applyServiceStyles = (log: LogDescriptor, messageKey: string) => {
let style;
switch (log.service) {
case SERVICES.KIOSK_APP_CLIENT:
style = bgLightBlue;
break;
case SERVICES.KIOSK_APP_SERVER:
style = bgYellow;
break;
case SERVICES.AWS_IOT_SERVER:
style = bgLightGreen;
break;
case SERVICES.AWS_IOT:
style = bgLightMagenta;
break;
default:
style = bgLightCyan;
break;
}
return `${black(style(`[${log.service}]`))} ${log[messageKey]}`;
};
const logger = pino({
prettyPrint: {
colorize: true,
errorLikeObjectKeys: ["err", "error", "details"],
levelFirst: true,
translateTime: "SYS:hh:MM:ss TT dd-mm-yyyy",
ignore: "pid,hostname,service",
messageFormat: (log, messageKey, levelLabel) => {
return applyServiceStyles(log, messageKey);
},
},
level: process.env.LOG_LEVEL || "debug",
serializers: {
error: pino.stdSerializers.err,
},
});alex-udisc
Metadata
Metadata
Assignees
Labels
No labels