Bug: 191700800

Clone this repo:
  1. c970024 Make kernlog available to product and vendor am: 88e5a784df by Matthew Maurer · 3 months ago main master android-u-beta-1-gpl
  2. 88e5a78 Make kernlog available to product and vendor by Matthew Maurer · 3 months ago
  3. d9ec8e6 Update TEST_MAPPING am: b8fd170159 by Jeff Vander Stoep · 4 months ago
  4. b8fd170 Update TEST_MAPPING by Jeff Vander Stoep · 4 months ago
  5. 45c4cb1 Merge "Update TEST_MAPPING" am: 8aea471660 am: cbf94d9634 am: e77c3db504 am: 2b2b24f95a by Treehugger Robot · 12 months ago main-16k-with-phones

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.