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

Splat format prints a meta object along with the message #1358

Closed
1 of 2 tasks
rjunior-admatic opened this issue Jun 12, 2018 · 2 comments
Closed
1 of 2 tasks

Splat format prints a meta object along with the message #1358

rjunior-admatic opened this issue Jun 12, 2018 · 2 comments

Comments

@rjunior-admatic
Copy link

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3

What is the problem?

Below is the execution of the following example https://github.com/winstonjs/winston/blob/master/examples/interpolation.js

info: test message my string {"meta":[]}
info: test message 123 {"meta":[]}
info: test message first, second {"meta":{"number":123}}
info: Found error at Tue Jun 12 2018 13:27:06 GMT-0300 (-03) {"meta":[]}
info: Found error at Error: chill winston {"meta":[]}
info: Found error at /WUT/ {"meta":[]}
info: Found error at true {"meta":[]}
info: Found error at 100 {"meta":[]}
info: Found error at 1, 2, 3 {"meta":[]}

As you can see, there are {"meta":[]} on every log entry.

What do you expect to happen instead?

Messages that match size of placeholders and parameters should not print the meta information

Other information

This is a regression of PR #1356

@ChrisAlderson
Copy link
Member

The easiest solution would be to delete these two lines in logform/splat, but I'm unsure why they were added since they were not in winston before the refactor. If @indexzero had a good reason to add those lines then it's a different story.

Should the splat format interact with the metadata format? If yes then we have an issue with the metadata key. In the metadata format we use metadata as a key, but in the splat format we use meta as the key. So we get something weird as you can see below. To solve this we could add a METADATA symbol to triple-beam`.

info: test message my string {"metadata":{"meta":[]}}

Then there is the question if the simple format should display the metadata. If not we add the metadata key to the stringifiedRest variable in the simple format.

@indexzero
Copy link
Member

@ChrisAlderson the question around splat and metadata formats is an interesting question. The challenge is that the additional SPLAT is not an object by definition. It is an ordered list. Not opposed to a METADATA symbol which could help these two formats interop better.

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

3 participants