[][src]Struct fluence::sdk::logger::WasmLogger

pub struct WasmLogger { /* fields omitted */ }

The Wasm Logger.

This struct implements the Log trait from the log crate, which allows it to act as a logger.

For initialization of WasmLogger as a default logger please see init() and init_with_level()

Methods

impl WasmLogger[src]

pub fn init_with_level(level: Level) -> Result<(), SetLoggerError>[src]

Initializes the global logger with a [WasmLogger] instance with max_log_level set to a specific log level.

if cfg!(target_arch = "wasm32") {
    logger::WasmLogger::init_with_level(log::Level::Error).unwrap();
}
error!("This message will be logged.");
info!("This message will not be logged.");

pub fn init() -> Result<(), SetLoggerError>[src]

Initializes the global logger with a [WasmLogger] instance with max_log_level set to Level::Info.

if cfg!(target_arch = "wasm32") {
    fluence::logger::WasmLogger::init().unwrap();
}

error!("This message will be logged.");
trace!("This message will not be logged.");

Trait Implementations

impl Log for WasmLogger[src]

Auto Trait Implementations

impl Send for WasmLogger

impl Sync for WasmLogger

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.