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

Can't log to stderr in tricky case #85

Closed
krazylek opened this issue Sep 10, 2016 · 2 comments · Fixed by #86
Closed

Can't log to stderr in tricky case #85

krazylek opened this issue Sep 10, 2016 · 2 comments · Fixed by #86

Comments

@krazylek
Copy link

Hello Matteo,

While playing with pino, I noticed a subtle bug, when stderr is redirected from bash like this:

node index.js 2> error.log

And index.js looks like

var pino = require('pino')
var log = pino(process.stderr)
log.warn('will output to stdout')

It seems related to the property _writableState which is undefined in this case.

So the condition opts && opts._writableState to assign opts to the stream, can't pass.

Note that it just happens when options are omitted!

Cheers,
Benoit

@davidmarkclements
Copy link
Member

Very nice catch

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants