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

Default to STDERR instead of STDOUT #19

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Default to STDERR instead of STDOUT #19

wants to merge 10 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 4, 2015

logxi is a great almost-drop-in replacement for the Go stdlib log package. However, log defaults to logging on STDERR, whereas logxi defaults to STDOUT. This presents a couple of issues:

  • This behavior breaks with Go stdlib logging convention
  • The user can not control, at runtime, whether logs are fed to STDERR or STDOUT
  • Users can't easily differentiate between logs and program output without code changes without extra code

This pull request changes the default output to STDERR.

tessro and others added 2 commits October 29, 2015 18:03
This patch restores stack trace logging. It avoids parsing stack trace
text, opting for runtime.Callers and runtime.FuncForPC instead.

Support for overriding the stack trace by setting KeyMap.CallStack was
removed. This only worked in happyDevFormatter, and would have triggered
a warning anyway, since it's a reserved key.
@mwmahlberg
Copy link

While I wholeheartedly would like to see this request merged, it is not quite true that a user can do nothing at runtime to redirect the output to STDERR, at least on a lot of Linux/Unix shells:

gopher 1>&2

The problem here is rather that this would also redirect output which is intended to go to STDOUT. Hence again, this is a good idea!

Russ Egan and others added 8 commits February 24, 2016 18:43
the ci.contextLines is never set (nor was it set in any prior version I could find), but the global contextLines var seems to have the right info.

Also:
- use the current line marker even when the context is one.  This is useful when colors are disabled.
- if source context line color is default, the color of the previous line was bleeding over.  Need to reset the color on each source line.
- found a couple more places where disableColors wasn't being honored
multiple go routines can use a formatter concurrently, and the writes to the formatter's "col" attribute were not synchronized.

Instead, create a local col var for each log write.
Fixed logger registration bug
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

Successfully merging this pull request may close these issues.

None yet

3 participants