Meta not included in logging of Error
See original GitHub issuePlease 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:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In general you shouldn’t expect
f(object.method)
to work same asf(() => 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.
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 tocatch
, I’m considering this an invalid issue and will be closing it.