env_logger
env_logger copied to clipboard
[feat] support star matching
https://nodejs.org/docs/latest/api/util.html#utildebuglogsection-callback
env NODE_DEBUG=foo* is able to match section foo-bar
Would be nice to have star matching, instead of literal matching.
For example, if one named john, he may set all his packages log level to debug using
RUST_LOG=john_*=debug
Note that we do prefix checks, rather than equality checks. So for the two module cases you gave, they should "just work".
Furthermore, the log can be filtered using prefix-search based on the specified log target.
From https://docs.rs/env_logger/latest/env_logger/#enabling-logging
If we were to support something fancier than prefix checks, we'd need to also consider internal consistency. We currently support regex filters on messages so we'd need to consider what target filter syntax we would support.
FYI, I should mentioned the use case when I create this feat.
My scenario was testing rust napi extension with nodejs and deno.
Although within nodejs, it works fine.
But witih deno, sometimes deno succcess, sometims deno hangs forever, sometimes seems deno resource released when still in used.
https://github.com/denoland/deno/issues/23253
I use env logger with RUST_LOG=*{{napi_method_name}}=debug, and did not work.
So, would be nice to support suffix name at least .
I have a similar situation where I'm using Rocket and some custom request guards.
The guards are generated via macros and thus end up using my module path as the output path (with a ::_ appended). They are way too verbose, logging warnings for things that do not matter.
I would like to do something like my::crate::guards::*::_=off or even my::**::_=off