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

Combining Formats section code output not matching documentation #1308

Closed
1 of 2 tasks
pflugs30 opened this issue May 10, 2018 · 3 comments
Closed
1 of 2 tasks

Combining Formats section code output not matching documentation #1308

pflugs30 opened this issue May 10, 2018 · 3 comments

Comments

@pflugs30
Copy link

Please tell us about your environment:

  • winston version?
    • winston@2
    • winston@3
  • node -v outputs: v8.10.0
  • Operating System? Windows
  • Language? ES6/7

What is the problem?

I'm running the sample code under the Combining Formats section. I've created a brand new Node project, and Winston is the only package installed. I created a new index.js file, and it only contains the code in the Combining Formats section. When I execute the code, I see the following log output:

{ level: 'info',
  message: 'What time is the testing at?',
  label: 'right meow!',
  timestamp: '2018-05-10T00:52:02.906Z',
  [Symbol(level)]: 'info' }

What do you expect to happen instead?

According to the text in the section, I should see:

{ level: 'info',
  message: 'What time is the testing at?',
  label: 'right meow!',
  timestamp: '2018-05-10T00:52:02.906Z' }

I'm not sure where the [Symbol(level)]: 'info' part is coming from or how to get rid of it. Is the sample output in the section inconsistent with the code? Should I change the configuration? Thank you.

@pflugs30
Copy link
Author

Update: I've narrowed the issue down to the prettyPrint call. I haven't looked into that function yet, but removing it and replacing it with format.json() causes the logger to output the log message I expect (of course, without the newline whitespace).

@pflugs30
Copy link
Author

My immediate project need is gone now after not using prettyPrint, especially since that was not a requirement for me as I'm pushing my logs to AWS CloudWatch which can format them in the viewer.

However, it still seems that there is something strange about prettyPrint or the documentation. I'm fine closing this issue since I no longer need help, but if it helps to keep this issue open to fix the issue with prettyPrint, that's fine, too.

@pflugs30
Copy link
Author

Decided to close this issue and move it to winstonjs/logform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant