I use pino caller to see where errors happens easily.
/*
Set LOG_LEVEL to one of (debug, error, fatal, info, silent, trace, warn)
*/
import pino from "pino";
import pinoCaller from "pino-caller";
var log = pino({
level: process.env.LOG_LEVEL?.toLowerCase() ?? 'info',
transport: {
target: "pino-pretty",
options: {
messageFormat: '{msg}',
ignore: 'pid,hostname,filename',
}
},
});
var log = pinoCaller(log)
export default log;
The current output is:
bun run src/index.ts
[14:31:23.288] ERROR <module code (/Volumes/Internal/pino/src/other.ts:3:4)>: other.ts
[14:31:23.297] ERROR <module code (/Volumes/Internal/pino/src/index.ts:3:4)>: index.ts
How can I configure it to be like:
[14:31:23.288] ERROR at /Volumes/Internal/pino/src/other.ts:3:4: other.ts
[14:31:23.297] ERROR at /Volumes/Internal/pino/src/index.ts:3:4: index.ts
Another issue related to pino: it doesn't print the rest parameters I provide like console.log
eg. logger.debug('hello', 'world') - only hello printed.
I use pino caller to see where errors happens easily.
The current output is:
How can I configure it to be like:
Another issue related to pino: it doesn't print the rest parameters I provide like
console.log
eg.logger.debug('hello', 'world')
- onlyhello
printed.