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

slog-envlogger: RUST_LOG with crate/module name seems to be ignored #203

Closed
phrohdoh opened this issue Mar 4, 2019 · 2 comments
Closed

Comments

@phrohdoh
Copy link

phrohdoh commented Mar 4, 2019

$ rustc --version
rustc 1.33.0 (2aa4c46cf 2019-02-28)

$ cargo --version
cargo 1.33.0 (f099fe94b 2019-02-12)

$ rustup --version
rustup 1.16.0 (beab5ac2b 2018-12-06)

See this repo (which I'll delete once/if this is resolved) for a repro case.


use slog::Drain;

fn main() {
    let decorator = slog_term::TermDecorator::new().stdout().build();
    let fmt = slog_term::CompactFormat::new(decorator).build().fuse();
    let drain = slog_envlogger::new(fmt);
    let (drain, _) = slog_async::Async::new(drain).build_with_guard(); // changing this to `build` changes nothing about the output

    let logger = slog::Logger::root(
        drain.fuse(),
        slog::o!(
            "some" => "thing",
        )
    );

    let _ = slog_stdlog::init().unwrap(); // changing this to `slog_envlogger::init` changes nothing about the output
    slog_scope::scope(&logger, slog_std_env::run);
}
pub fn run() {
    log::trace!("trace");
    log::debug!("debug");
    log::info!(" info");
    log::warn!(" warn");
    log::error!("error");
}
[package]
name = "slog_std_env"
version = "0.1.0"
authors = ["Phrohdoh"]
edition = "2018"

[dependencies]
log = "0.4.6"
slog = "2.4.1"
slog-stdlog = "3.0.2"
slog-envlogger = "2.1.0"
slog-term = "2.4.0"
slog-scope = "4.1.1"
slog-async = "2.3.0"

With the above running like so:

$ RUST_LOG=slog_std_env=info cargo run

nothing from the crate (neither lib nor bin) is logged.

I saw #198 which is where I got the build_with_guard from, but that didn't change anything.


Edit:

Running it like so:

$ RUST_LOG=info cargo run

For example, does log as expected, but once a crate/module name is introduced nothing is logged.

@dpc
Copy link
Collaborator

dpc commented Apr 22, 2019

Root of the problem: slog-rs/stdlog#5

@teotwaki
Copy link

teotwaki commented Mar 8, 2020

@dpc I believe this can be closed?

@dpc dpc closed this as completed Mar 8, 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

3 participants