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

[feat] support star matching #315

Open
loynoir opened this issue Apr 6, 2024 · 3 comments
Open

[feat] support star matching #315

loynoir opened this issue Apr 6, 2024 · 3 comments

Comments

@loynoir
Copy link

loynoir commented Apr 6, 2024

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

@epage
Copy link
Contributor

epage commented Apr 15, 2024

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.

@loynoir
Copy link
Author

loynoir commented Apr 15, 2024

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.

denoland/deno#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 .

@hcldan
Copy link

hcldan commented Apr 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants