Bug: 191700800

Clone this repo:
  1. 8aea471 Merge "Update TEST_MAPPING" by Treehugger Robot · 3 weeks ago master
  2. 4d4686a Update TEST_MAPPING by Matthew Maurer · 3 weeks ago
  3. b9015da Update TEST_MAPPING am: e59302f6e7 by Matthew Maurer · 5 weeks ago
  4. e59302f Update TEST_MAPPING by Matthew Maurer · 6 weeks ago
  5. 0f712bd Merge "Refresh Android.bp, cargo2android.json, TEST_MAPPING." am: 0f803e21ea am: 2a33a59bb6 am: a59422bd88 by Joel Galenson · 7 months ago

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.