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.

Meta not included in logging of Error

See original GitHub issue

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: v11.6.0
  • Operating System? macOS
  • Language? all

What is the problem?

Using defaultMeta while logging a JS Error does not include the default meta values… e.g. in the .catch of a Promise

.catch(logger.error)

What do you expect to happen instead?

The attributes/values of defaultMeta should be included, but are not.

Other information

🐞 I believe there could be a bug somewhere around here. Maybe either this._addDefaultMeta(msg) or Object.assign({}, this.defaultMeta, ... is missing in some cases.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
peeycommented, Aug 9, 2021

In general you shouldn’t expect f(object.method) to work same as f(() => object.method())

You can see that at the following line, what you’re doing would break the this binding.

https://github.com/winstonjs/winston/blob/2625f60c5c85b8c4926c65e98a591f8b42e0db9a/lib/winston/logger.js#L645

Unless you explicitly use .bind, which the library authors may have done inconsistently in some places so it might work. But in general the responsibility lies with the library user and not the library to not break the binding.

0reactions
maverick1872commented, Feb 9, 2022

I believe this to be a case of improperly using a catch clause on the Promise instance. For reference, this clause expects a function that it will then call in a rejection scenario. Since the original example is that of someone passing an Error instance as the function argument to catch, I’m considering this an invalid issue and will be closing it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to troubleshoot Meta Pixel error and warning messages ...
Error and warning messages you may see for the Meta Pixel in Events Manager · Invalid currency code · Missing event name ·...
Read more >
Meta is null in Winston-mongodb - node.js - Stack Overflow
I am using winston-mongodb modlue to log the request response. I am trying to add meta data to logger. But it is adding...
Read more >
JSON API responses no longer contain errors under `meta ...
In JSON API 1.x, for most cases, an error object was then added under the meta.errors key for that entity. This is no...
Read more >
I'm having problems setting up a Meta account
I created a Meta account but my apps and data are missing ... Facebook while setting up your Meta account, do not attempt...
Read more >
JR31484: "PROCESS META DATA NOT AVAILABLE IN ... - IBM
APAR status. Closed as program error. Error description. Following log message is always put when a job which has ODBC EE/Netezza stage to...
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