Skip to content
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

Custom fields always part of a log message #457

Closed
Ankan-Fraedom opened this issue Nov 1, 2016 · 1 comment
Closed

Custom fields always part of a log message #457

Ankan-Fraedom opened this issue Nov 1, 2016 · 1 comment

Comments

@Ankan-Fraedom
Copy link

Hi there, using this awesome logging framework, so thanks a lot for creating and maintaining. Just wondering is it possible to add a custom filed in bunyan which will always appear no matter what I log. Like a requestId appearing always in the log message like a Pid, date etc. would be awesome. Please let me know. Cheers.

@trentm
Copy link
Owner

trentm commented Nov 8, 2016

Yes, that is the default behaviour for all fields other than a few special ones. See https://github.com/trentm/node-bunyan/#constructor-api or, for example:

var log = bunyan.createLogger({name: 'myapp', requestId: genRequestId});

log.info('hi'); // This log record will have 'name' and 'requestId' fields per the constructor above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants