Closed topninja closed 2 years ago
Remove messageFormat
and you'll see a full stack trace.
I tried to do by removing messageFormat but shows only 1 line like above image.
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
I added reproduction example already.
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) });
logger.error("payload is not valid");
You are not creating an error, so there is no stacktrace. If you want to get a stacktrace, create an error.
Hello team. I added logger in many places of my project And sometimes logger has error logs.
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