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

SimpleLogger::env doesn't (fully) simulate env_logger #75

Closed
d4h0 opened this issue Jan 26, 2023 · 4 comments · Fixed by #87
Closed

SimpleLogger::env doesn't (fully) simulate env_logger #75

d4h0 opened this issue Jan 26, 2023 · 4 comments · Fixed by #87

Comments

@d4h0
Copy link

d4h0 commented Jan 26, 2023

The docs of SimpleLogger::env say "Simulates env_logger behavior", but this doesn't seem to be true.

The docs of env_logger mention "Logging is controlled via the RUST_LOG environment variable. The value of this environment variable is a comma-separated list of logging directives.", but comma-seperated logging directives are not supported in simple_logger:

    pub fn env(mut self) -> SimpleLogger {
        self.default_level = std::env::var("RUST_LOG")
            .ok()
            .as_deref()
            .map(log::LevelFilter::from_str)
            .and_then(Result::ok)
            .unwrap_or(self.default_level);

        self
    }

PS: Thanks for creating simple_logger. I like it quite a lot, and use it for all projects for which the tracing crate would be over-kill.

@borntyping
Copy link
Owner

A PR to update this would be welcome - only the RUST_LOG=info style is supported. (There are no plans to add the same filtering capabilities as env_logger provides.)

@userffx
Copy link

userffx commented Dec 6, 2023

SimpleLogger::with_module_level already exists, adding support for RUST_LOG based filtering seems trivial

why is it not planned ?

@borntyping
Copy link
Owner

I added a notice to the project recently that covers this: https://github.com/borntyping/rust-simple_logger#project-status

In short - no features have been planned for this library for the better part of a decade. I keep up with bugfixes and merge contributed features that fit the project's goal of being simple, but I'm not interested in doing much more than that as I don't use the project myself.

If there's truely a trivial implementation for this, I'd welcome a pull request :)

@userffx
Copy link

userffx commented Dec 7, 2023

i don't know if the code is simple enough but i created #89 anyway

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

Successfully merging a pull request may close this issue.

3 participants