Message not encoded on 'info' object using triple-beam
See original GitHub issuePlease tell us about your environment:
winston
version?-
winston@2
-
winston@3
-
node -v
outputs:- Operating System? (Windows, macOS, or Linux)
- Language? (all | TypeScript X.X | ES6/7 | ES5 | Dart)
What is the problem?
In the Console
transport, the message is read from the info
object with the following logic:
const { LEVEL, MESSAGE } = require('triple-beam');
...
log() {
....
console._stderr.write(`${info[MESSAGE]}${this.eol}`);
The problem is that the message is placed on the info object using a standard 'message'
string key:
this.write({ [LEVEL]: level, level, message: msg });
What do you expect to happen instead?
Shouldn’t the message be placed on the info object using the triple-beam MESSAGE
symbol?
this.write({ [LEVEL]: level, level, [MESSAGE]: msg, message: msg });
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Triple Beam Balance
Triple beam balance. Instructions on use. The triple beam balance is used to measure masses very precisely; the reading error is 0.05 gram....
Read more >Cognitive psychology book notes
Inattentional blindness is a failure to perceive an unattended object because its features were not successfully bound by attention.
Read more >Third Party Licenses
... @aws-sdk/util-hex-encoding; @aws-sdk/util-locate-window ... has-unicode; hosted-git-info; icss-replace-symbols; icss-utils; idb; ignore-by-default ...
Read more >Base station beam sweeping method and apparatus using ...
A method and apparatus for wireless communications wherein a base station transmits and receives wireless signals through multiple directional antennas ...
Read more >Science Prep Test #1 Flashcards
C - Sending messages about the correct sequence of proteins in DNA ... A - DNA carries genetic information from RNA to the...
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
This is crazy confusing behaviour - I just spent a few hours debugging this. Let me provide an example:
This simply logs undefined, when according to the docs it should work. I spent a few hours before finding out you have to set info[MESSAGE] with the symbol from triple-beam. I think we should log an error if there’s no info[MESSAGE] and document that you have to finish with a “finalizing logger” - there’s no real mention of them in the docs.
Edit: Looking at it, I see that instead of using winston.format to create the custom format, it’s using printf. Perhaps all you need is some documentation in the
implementing custom format
docs then.This is something we should consider, but it is currently by design. This is a corner case where someone has opted to not include a “finalizing formats”:
json
logstash
printf
prettyPrint
simple
All of these would set the
MESSAGE
symbol for you. Does that make sense @jd-carroll?