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

logging error should go to stderr instead of stdout #9547

Closed
xmonader opened this issue Oct 28, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@xmonader
Copy link
Contributor

commented Oct 28, 2018

logging module logs errors error proc for Console writes to stdout instead of stderror

Example

var L* = newConsoleLogger()
addHandler(L)

error("should got to stderr")

Current Output

stderr is empty
stdout has the message

Expected Output

stderr has the message
stdout is empty

Possible Solution

having a special case for errors to stderr instead of stdout
https://github.com/nim-lang/Nim/blob/master/lib/pure/logging.nim#L153

@dom96

This comment has been minimized.

Copy link
Member

commented Oct 28, 2018

Araq will probably hate me for this. But in fact, shouldn't all logs go to stderr?

The main reason for this is that stderr is where diagnostic information should go. Stdout is where the programs output goes, and keeping stdout clean of diagnostic information allows a program's output to be easily piped to other programs.

@dom96 dom96 added the Stdlib label Oct 28, 2018

@krux02

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2018

@dom96 I totally agree. Even though I don't think piping program output around and parsing it isn't really good software design.

@xmonader

This comment has been minimized.

Copy link
Contributor Author

commented Oct 29, 2018

It sounded like an easy to pick task so I created a PR for it #9554

@Araq Araq closed this in #9554 Oct 30, 2018

Araq added a commit that referenced this issue Oct 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.