env_logger icon indicating copy to clipboard operation
env_logger copied to clipboard

Journald

Open imbolc opened this issue 4 years ago • 6 comments

My question is similar to #178, but about systemd journal as an additional target. Systemd crate already exposes log_record() as a part of its public api. What do you think about adding it as a dependency behind a feature-flag?

imbolc avatar Feb 13 '21 16:02 imbolc

Would this approach work for journald integration?

jplatte avatar Feb 15 '21 13:02 jplatte

It could be done with a trait object, but I'm afraid std::io::Write wont be enough, as it consumes just bytes. Journald stores structured data so it would need log level and all the logged variables if kv_unstable feature is enabled.

imbolc avatar Feb 15 '21 14:02 imbolc

I see. Well I'm afraid I'm only doing light maintenance here and can't really provide more than a few cross links.

CC @KodrAus

jplatte avatar Feb 15 '21 14:02 jplatte

I found it's easy to make it with tracing, in case someone else will need this: https://gist.github.com/imbolc/f75f924f66c129f0e1e910f59fb75c0d

imbolc avatar Feb 16 '21 14:02 imbolc

I wrote a wrapper to use the filter part of env_logger with any Log implementation (https://gist.github.com/lunaryorn/a2f63c6daa11fabec764caeb8a65dd00) which I use together with a separate journal logging crate

swsnr avatar May 29 '21 11:05 swsnr

Are there any updates for this one yet?

TornaxO7 avatar Sep 06 '22 23:09 TornaxO7