fern icon indicating copy to clipboard operation
fern copied to clipboard

Specific log level for some module

Open xairaven opened this issue 1 year ago • 2 comments

Hello! Can you please tell me if it is possible to "mute" messages from some modules? For example, the module teloxide::error_handlers sometimes logs some message with ERROR level. And I would like to redirect all module logs to DEBUG. Is it possible?

I found the level_for method, but it doesn't work, not sure if this is what I need:

.level_for("teloxide::error_handlers", LevelFilter::Debug)

I keep getting ERROR level logs from this module.

xairaven avatar Aug 10 '24 14:08 xairaven

@daboross Sorry for tagging, I can't figure out how to solve the problem. I would be very grateful for advice

xairaven avatar Jan 15 '25 19:01 xairaven

The level_for function only sets the minimum level that is logged for the target. It does not 'redirect' anything; it is a simple filter.

You can probably implement what you want using a custom filter: https://docs.rs/fern/0.7.1/fern/type.Filter.html

JEleniel avatar Jul 26 '25 14:07 JEleniel