Attribute Macro defmt::global_logger

source ·
#[global_logger]
Expand description

Defines the global defmt logger.

#[global_logger] needs to be put on a unit struct type declaration. This struct has to implement the Logger trait.

§Example

use defmt::{Logger, global_logger};

#[global_logger]
struct MyLogger;

unsafe impl Logger for MyLogger {
    fn acquire() {
        // ...
    }
    unsafe fn flush() {
        // ...
    }
    unsafe fn release() {
        // ...
    }
    unsafe fn write(bytes: &[u8]) {
        // ...
    }
}