-
Notifications
You must be signed in to change notification settings - Fork 258
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
Doesn't work with /examples
folder
#647
Comments
@setoelkahfi the log crate only provides a logging facade, you'll also need an implementation that does the actual logging. See one of the implementation in https://github.com/rust-lang/log?tab=readme-ov-file#in-executables. |
@Thomasdezeeuw I'm building a library. And per the readme, I should only link the log crate. |
Yes. Then you can add an implementation as |
I don't think I get this. I tried to use the env_logger one, for example, I tried to init it in my lib.rs file, but it says use crate::model::{ErrorDetail, ErrorResponseCode, Link, SessionError};
use log::{debug, info};
use reqwest::{Client, Response, StatusCode};
env_logger::init(); // Can't do Do I need to specify a specific feature? |
In Rust you can't put a statement like that at the top level of the source code. You can put in the #[tokio::main]
async fn main() {
env_logger::init();
log::info!("It worked");
} |
Hello, this log doesn't seem to work with the
Cargo
examples directory. Is it by design?I have a
basic.rs
file inside my examples folder crate. This doesn't print the log information:This one does:
I ran that example with:
cargo run --example basic
The text was updated successfully, but these errors were encountered: