-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pino prefix string to each log line #544
Comments
Thanks for reporting! This is currently not possible. |
I'd suggest creating a little library for this, you could call it function pinoPrefix(prefix, pinoInstance) {
const { levels } = pinoInstance
const { values } = levels
Object.keys(values).forEach((level) => {
const LOG = pinoInstance[level].bind(pinoInstance)
pinoInstance[level] = (msg, ...args) => {
return LOG(typeof msg === 'string' ? prefix + msg : msg, ...args)
}
})
return pinoInstance
} In terms of putting it in core, we're happy to review PR's but it would need to have the following properties
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
is there any option to add some const string to pino logger so for every log line we use "info" for example so i may add some prefix string that will be added ?
e.g
pino.info(
${my prefix} some log line
);pino.info(
${my prefix} some other log line
);The text was updated successfully, but these errors were encountered: