-
Is there a way to set different log levels for different crates (to filter verbose debug messages of some libs), something like |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
The current journal There may be other crates that allow control over the output to the systemd journal, or if not, one could write one that uses the APIs exposed in this crate to log output. I've, in the past, thought about splitting out the support for Right now this is the extent of our logger: Modifying the I'm open to accepting changes to the included logger that add some filtering functionality. Even better if there's some existing log filtering crate we can just pull in and call in |
Beta Was this translation helpful? Give feedback.
-
You're right, it makes more sense to add journal as a target to |
Beta Was this translation helpful? Give feedback.
-
I'm not sure env_logger really has a setup for plugable outputs: it appears to just expose stderr and stdout. There are other logging systems (slog, tracing) that do have plugable outputs and have some support for filtering in similar ways to env_logger. For those, I believe the approach is to create a new crate that adapts the logging framework (slog/tracing) to the output sink (systemd journal, in this case). (Even if the solution you go with doesn't involve updating this systemd crate to add filtering, I'd be very interested in what you end up using) |
Beta Was this translation helpful? Give feedback.
-
Yep, there's no plugins in env_logger, though they're already discussing adding a file Target, so I've opened a similar issue on journald. Tracing already has journald subscriber. It just emotionally hard for me to bring tracing into a simple cli tool with a synchronous workflow :) |
Beta Was this translation helpful? Give feedback.
-
Hey :) I ended up using tracing, here's the setup: https://gist.github.com/imbolc/f75f924f66c129f0e1e910f59fb75c0d |
Beta Was this translation helpful? Give feedback.
Hey :) I ended up using tracing, here's the setup: https://gist.github.com/imbolc/f75f924f66c129f0e1e910f59fb75c0d