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

alternative behaviour for metaAsColumns=false #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

GeekyDeaks
Copy link

When using the option metaAsColumns=false everything is considered meta, even the log level and message, so you only ever end up with a meta field in the table. I felt this was unexpected based on my experience with other transports, but I appreciate that it may well be as designed, hence the wording of the commit message.

This change omits the level and message elements from the meta when metaAsColumns=false

It's probably still not ideal. The core transports appear to only use the message element when outputting and rely upon the format chain to create the appropriate message, but doing that would not make use of the azure table features. Maybe there should be an option of which fields to pull out of the meta?

Any thoughts?

@GeekyDeaks
Copy link
Author

ah - this is not as simple as I initially thought. format.splat() creates a meta element, which I think it would be better to use, as it closely emulates the way v2.0 of winston worked.

I'll submit an update, but this one is going to be a more sweeping change as it will also alter the way metaAsColumns=true works

@GeekyDeaks
Copy link
Author

Ok, I have dug into this way further than I ever intended :)

There appears to be an issue with winston.js polluting the format object if the first parameter is an object, which I suspect is causing the pollution I am seeing when using metaAsColumns=true.

I have raised it in the main winston.js project: winstonjs/winston#1510

If it really is an issue with winston.js and not by design, then it reduces this change to nothing more than a workaround

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

Successfully merging this pull request may close these issues.

1 participant