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

Select a different output fd #62

Closed
Veetaha opened this issue Aug 21, 2020 · 3 comments
Closed

Select a different output fd #62

Veetaha opened this issue Aug 21, 2020 · 3 comments

Comments

@Veetaha
Copy link

Veetaha commented Aug 21, 2020

Hi, this crate is a perfect low-overhead logger implementation I want.
However, from my point of view, human-readable logs should go to stderr instead of stdout.
Would it be possible to add some configuration to select stderr or stdout output for the crate?
Maybe through a cargo feature or via an init function?

@Drakulix
Copy link
Owner

Drakulix commented Aug 23, 2020

Already possible for TermLogger! You can initialize it with a TerminalMode, which can either be stdout/stderr or mixed-mode.

You could also manually initialize WriteLogger with any type implementing Write, which also applies to std::io::Stderr. But you would miss out on colored output.

Only SimpleLogger just uses println! internally and will always write to stdout.
But I would accept a PR to make SimpleLogger configurable (similar to TermLogger) to use eprintln! instead.

@Veetaha
Copy link
Author

Veetaha commented Aug 25, 2020

Oh, I think I have mistaken this project with https://github.com/borntyping/rust-simple_logger
The issue is that simplelog.rs unconditionally depends on chrono, but I would like a logger with 0 dependencies which outputs to stderr...

@Drakulix
Copy link
Owner

Drakulix commented Sep 2, 2020

Well, I would certainly accept a PR, that makes chrono optional and just disables time-formatting/output, if you are interested.

Anyway, I guess the original issue is resolved. Feel free to open another one on the subject, if needed.

@Drakulix Drakulix closed this as completed Sep 2, 2020
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

2 participants