-
Notifications
You must be signed in to change notification settings - Fork 94
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
Pass meta data into logFormat() #41
Comments
I misread your issue. I did a PR for something else but it would be nice to get the meta in too. |
@ricolo I opened a PR that adds this: #50 If that gets merged, you can do: logFormat: function(level, message, originalMessage, meta) {
return 'META ' + meta;
} Note that winston-paptertrail formats the message and I opened the PR as I want the original message so I can format it. So that 3rd parameter (originalMessage) may not be interesting to you but would be present. |
Thanks a lot @cymen, would you also modify the documentation (e.g. https://github.com/kenperkins/winston-papertrail#advanced-usage) as well to reflect the expanded capability? |
@ricolo I did in PR #51 but it hasn't been merged yet. I needed this ASAP so I temporarily put a fork of this out here: https://www.npmjs.com/package/winston-papertrail-enhanced You could try that to get the functionality. But hopefully #51 will get in soon and I'll deprecate my fork. The documentation is here: https://www.npmjs.com/package/winston-papertrail-enhanced#messageformat |
@cymen I overlooked it, thanks! |
This issue should stay open as long as the PR is open. |
Currently,
logFormat()
input arguments arelevel
andmessage
, and I wonder if meta data can also be passed into the function for reformatting.I use meta data to identify the log from different components of my system, so it may not be the best way to display if it is only printed at the end of the log message for meta data. Winston's file and console transport also provide meta data for the log formatter.
The text was updated successfully, but these errors were encountered: