question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi there,

version: 3.0.0-rc1

There is a nasty bug, which prevents metadata (e.g. info.meta) to be accessible inside formatter unless there is at least one splat along with meta data.

Reproducing this bug is simple:

// THIS IS THE EXAMPLE THAT DOESN’T WORK AS EXPECTED // If you try to log meta data, it will NOT work (u won’t be able to access info.meta inside formatter), // unless there is at least one ‘splat’ included. logger.info('my message', { reason: 'whatever', promise: 'whenever' });

// THIS EXAMPLE WORKS FINE // In order to properly log meta data along with ‘my message’ you are forced to include at least one splat. logger.info('my message%s', 'It needs one splat that i do not need', { reason: 'whatever', promise: 'whenever' }); https://github.com/winstonjs/winston/blob/3b6da2c00b24a90bb6c99f2ae69fa8302f9f03d9/lib/winston/logger.js#L173

line 173: const info = Object.assign({}, meta, { [LEVEL]: level, level, message: msg });

Should be changed to: const info = Object.assign({}, { [LEVEL]: level, level, message: msg, meta });

With this change ,info.meta is accessible inside formatter regardless if there are any ‘splats’ included or not and it is now also sorted properly if you do a console.log on the info object (same order with splats or without any splat).

Can someone please test this bug and if the ‘code fix’ looks good, please apply this patched code to the project.

Best regards, Jim

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
guiguancommented, Mar 7, 2018

@teneon I included your fix in this pull request https://github.com/winstonjs/winston/pull/1229

0reactions
indexzerocommented, Mar 9, 2018

Thanks for highlighting this @teneon. This is not a bug. Hopefully this example clears it up for you: https://github.com/winstonjs/winston/pull/1235

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I fix the Meta Data error? | Apple Developer Forums
How do I fix the Meta Data error?
Read more >
Plex TV Show meta data (my fix for a metadata bug) - Reddit
For the life of me, I can't get TV metadata to work (except for one show) but Movie metadata is fine. If fiddled...
Read more >
Detecting metadata bugs on the fly - IEEE Xplore
A paper that appears in the main technical program of ICSE 2012 describes the idea, concept, and prototype of metadata invariants [4]. The...
Read more >
Troubleshooting Metadata Errors
When working with your data in the Metadata canvas, you may encounter the following error message. This message could mean that there is...
Read more >
Meta Data Problem - WordPress.org
What are your settings on the WP Recipe Maker > Settings > Metadata page? ... No, that warning is not a problem. It's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found