pino-pretty icon indicating copy to clipboard operation
pino-pretty copied to clipboard

Where's my error occur in my project? (How to find exact code line and its file name)

Open topninja opened this issue 2 years ago • 0 comments

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 image 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

topninja avatar Aug 13 '22 05:08 topninja