Bug: 191700800

Clone this repo:
  1. 52f94ca Migrate 25 crates to monorepo by James Farrell · 3 weeks ago main master
  2. ee4e0c6 Add patch for LICENSE and make Cargo.toml match the crate archive. by James Farrell · 3 weeks ago
  3. 88722bc Update Android.bp by running cargo_embargo am: d1707cadaf by James Farrell · 3 months ago
  4. d1707ca Update Android.bp by running cargo_embargo by James Farrell · 3 months ago
  5. a1fcb0f Update Android.bp by running cargo_embargo am: aba8833ddd am: ff490bf93e by James Farrell · 5 months ago android15-tests-dev

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.

Full documentation.

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.