pub struct WasmLoggerBuilder { /* private fields */ }Expand description
The Wasm logger builder.
Build logger for the Fluence network, allows specifying target map and log level while building.
Implementations§
Source§impl WasmLoggerBuilder
impl WasmLoggerBuilder
Sourcepub fn new() -> WasmLoggerBuilder
pub fn new() -> WasmLoggerBuilder
Initializes a builder of the global logger. Set log level based on the WASM_LOG environment variable if it set, or [[WASM_DEFAULT_LOG_LEVEL]] otherwise. It is an initial method in this builder chain, please note, that logger wouldn’t work without subsequent build() call.
Sourcepub fn with_log_level(self, level: LevelFilter) -> WasmLoggerBuilder
pub fn with_log_level(self, level: LevelFilter) -> WasmLoggerBuilder
Set the log level.
Sourcepub fn with_target_map(
self,
map: HashMap<&'static str, i32>,
) -> WasmLoggerBuilder
pub fn with_target_map( self, map: HashMap<&'static str, i32>, ) -> WasmLoggerBuilder
Set mapping between logging targets and numbers. Used to efficiently enable & disable logs per target on the host.
pub fn filter( self, module_name: impl Into<String>, level: LevelFilter, ) -> WasmLoggerBuilder
Sourcepub fn build(self) -> Result<(), SetLoggerError>
pub fn build(self) -> Result<(), SetLoggerError>
Build the real logger.
This method is a last one in this builder chain and MUST be called to set logger up. Returns a error
ⓘ
logger::WasmLoggerBuilder::new()
.with_log_level(log::LevelFilter::Trace)
.with_target_map(<_>::default())
.build()
.unwrap();Auto Trait Implementations§
impl Freeze for WasmLoggerBuilder
impl RefUnwindSafe for WasmLoggerBuilder
impl Send for WasmLoggerBuilder
impl Sync for WasmLoggerBuilder
impl Unpin for WasmLoggerBuilder
impl UnsafeUnpin for WasmLoggerBuilder
impl UnwindSafe for WasmLoggerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more