-
Notifications
You must be signed in to change notification settings - Fork 31
Set log verbosity of libraries #46
Comments
Full on over-engineering mode: allow manual mapping from verbosity count to filters. main! {
logging {
0 => Error;
1 => Warn;
2 => (me, Info), Warn;
3 => (me, Info), ("my_lib", Info), Warn;
4 => Info;
5 => Debug;
_ => Trace;
}
|args: Cli, log_level: verbosity| {
// ...
}
} |
Actually, it seems like the |
How about this:
|
@killercup I like that plan. I wouldn't want to go any further than that to keep |
My CLI is split in a lib and a bin crate, inside a workspace. The bin crate is only used to parse options, read input file, etc. The main logic is moved to the lib so it can be re-used elsewhere. As such, I don't really care about the logging level of the bin crate, as it's mostly empty. I would like to "forward" the verbosity to my lib. And optionally, it would make sense I guess to be able to control all others too using |
Actually, I think my original issue was #60 |
It'd be nice if you could max out the log level if you really wanted to. Say things start with @killercup 's proposal, but then if you max out "our log level" it starts increasing all library verbosity as well. Otherwise it seems like the behavior is to override RUST_LOG and there's no way to see debug messages from libraries. |
When setting verbosity via
StructOpt
, logging from the binary is set to the listed verbosity, but all dependencies are alwaysWarn
only.quicli/src/main_macro.rs
Lines 46 to 47 in 3a2f20e
In my case I have a binary which is a different crate from the library it's a front to, because I'm already in a large workspace and I want to separate out the binary's dependencies from the library's, which is used elsewhere as well.
I would like to be able to allow the verbosity setting to effect certain dependencies as well. Side note, when at verbosity=0, the dependencies are louder than the first-party code 😄
The text was updated successfully, but these errors were encountered: