7 releases
0.3.1 | Sep 6, 2020 |
---|---|
0.3.0 | Sep 6, 2020 |
0.2.1 | Dec 28, 2015 |
0.2.0 | Jul 8, 2015 |
0.1.2 | Jul 4, 2015 |
#248 in Debugging
7,549 downloads per month
Used in 2 crates
7KB
107 lines
Kernel logger for Rust
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.
Usage
[dependencies]
log = "0.4"
kernlog = "0.3"
#[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.
lib.rs
:
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 = "0.4"
kernlog = "0.3"
#[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"]
Dependencies
~130KB