Struct kiibohd_log::Logger[][src]

pub struct Logger { /* fields omitted */ }
Expand description

Logger Structure

Example RTT Usage

use kiibohd_log::{log, Logger};

static LOGGER: Logger = Logger::new(log::LevelFilter::Info);

fn main() {
    // Setup RTT logging
    let mut channels = rtt_target::rtt_init_default!();

    // cortex-m or riscv
    //rtt_target::set_print_channel(channels.up.0);
    // otherwise use set_print_channel_cs
    log::set_logger(&LOGGER).unwrap();

    // Example usage
    log::trace!("Trace message");
    log::debug!("Debug message");
    log::info!("Info message");
    log::warn!("Warn message");
    log::error!("Error message");

    // Read downchannel
    let mut buf = [0u8; 16];
    channels.down.0.read(&mut buf[..]);
    log::trace!("{:?}", buf);
}

Example Semihosting Usage

use kiibohd_log::{log, Logger};

static LOGGER: Logger = Logger::new(log::LevelFilter::Info);

fn main() {
    log::set_logger(&LOGGER).unwrap();

    // Example usage
    log::trace!("Trace message");
    log::debug!("Debug message");
    log::info!("Info message");
    log::warn!("Warn message");
    log::error!("Error message");
}

Implementations

Trait Implementations

Determines if a log message with the specified metadata would be logged. Read more

Logs the Record. Read more

Flushes any buffered records.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.