pino-pretty
pino-pretty copied to clipboard
Where's my error occur in my project? (How to find exact code line and its file name)
Hello team. I added logger in many places of my project And sometimes logger has error logs.
const pino = require('pino');
const path = require('path');
const logger = pino({
prettyPrint: {
messageFormat: '{filename}: {msg}',
ignore: 'pid,hostname,filename',
}
}).child({ filename: __dirname + '\\' + path.basename(__filename) });
I did like this so I can see which file, and its error message
But I want to know which line produce this error so I can find issue easily.
How to do this?
Thanks
p.s. logger.error(new Error('payload is not valid')) by this, I can get line but shows few more.. I want only 1 line