-
Notifications
You must be signed in to change notification settings - Fork 139
changing target to stdout did not take effect? #108
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
Comments
Hi @sallyyu0 👋 There are a few things going on here.
Your logs should end up being written to
This one is Rust itself being picky. Usually you only put
This one is our bad. That |
Hi KodrAus, About the build error: When I don't have "extern crate env_logger;", I get this error instead. |
Ah right. Yeh,
I think this is another picky modules error. You shouldn't need the |
It looks we've worked through your original concerns @sallyyu0 so I'll go ahead and close this one now. Please feel free to re-open it or start a new issue if there's anything else you'd like to clarify! |
Hello,
I'm changing println! to info! when using the env_logger and trying to change target to stdout. However it does not seem to make any different. All logs still go to console. Is not it supposed to be different?
Cargo.toml:
[dependencies]
log = "0.4"
env_logger = "0.5"
lib.rs:
extern crate log;
extern crate env_logger;.
logger.rs
extern crate log;
extern crate env_logger;
use std::env;
use log::*;
use self::env_logger::{Builder, Target};
println!("env RUST_LOG as {:?}", env::var("RUST_LOG"));
Note that I did get following error and not sure why So I made change as instructed by adding "self", it passed.
8 | use env_logger::{Builder, Target};
| ^^^^^^^^^^ Did you mean
self::env_logger
?==========================
Here is the output of cargo run as well as docker run:
env RUST_LOG as Ok("info")
INFO 2018-11-02T19:17:37Z: myapp::utils::logger: builder=Logger { filter: Filter { filter: None, directives: [] }, writer: Logger { target: Stdout, write_style: Auto } }
The text was updated successfully, but these errors were encountered: