Crate kernlog [] [src]

Logger implementation for low level kernel log (using /dev/kmsg)

Usually intended for low level implementations, like systemd generators, which have to use /dev/kmsg:

Since syslog is not available (see above) write log messages to /dev/kmsg instead.

Examples

[dependencies]
log = "*"
kernlog = "*"
#[macro_use]
extern crate log;
extern crate kernlog;
 
fn main() {
    kernlog::init().unwrap();
    warn!("something strange happened");
}

Note you have to have permissions to write to /dev/kmsg, which normal users (not root) usually don't.

If compiled with nightly it can use libc feature to get process id and report it into log. This feature is unavailable for stable release for now. To enable nightly features, compile with --features nightly:

[dependencies.kernlog]
version = "*"
features = ["nightly"]

Structs

KernelLog

Kernel logger implementation

Functions

init

Setup kernel logger as a default logger