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

Use try_build instead of build when building terminal logger. #3

Closed
dpc opened this issue Nov 10, 2017 · 2 comments
Closed

Use try_build instead of build when building terminal logger. #3

dpc opened this issue Nov 10, 2017 · 2 comments

Comments

@dpc
Copy link
Contributor

dpc commented Nov 10, 2017

https://github.com/sile/sloggers/blob/master/src/terminal.rs#L123

term crate can fail to return a terminal (eg. if TERM is not set) and TerminalDecorator will just not do any logging which is confusing to the users.

Instead, use https://docs.rs/slog-term/2.2.0/slog_term/struct.TermDecoratorBuilder.html#method.try_build and in case of None use https://docs.rs/slog-term/2.2.0/slog_term/struct.PlainDecorator.html with io::stdout/io::stderr` or something like that that gives at least plain output.

Related: Stebalien/term#79

@dpc
Copy link
Contributor Author

dpc commented Nov 10, 2017

Actually I think I'm going to fix it in slog-term itself.

sile added a commit that referenced this issue Nov 11, 2017
@sile
Copy link
Owner

sile commented Nov 11, 2017

Thank you for your advice. I fixed this problem in sloggers-v0.2.2.

@sile sile closed this as completed Jun 17, 2018
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