pub struct Logger { /* private fields */ }Expand description
A handle for writing messages to a specific log backend.
Core follows a “no global mutable state” architecture. Callers that require
a non-default logging backend must create a Logger instance and use
it directly.
By default, macros like alog_info! use a platform-appropriate default
logger (LogBackend::Android on Android, LogBackend::Stderr otherwise).
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn new(backend: LogBackend) -> Self
pub fn new(backend: LogBackend) -> Self
Create a new logger with the specified backend.
Sourcepub fn log(&self, level: LogLevel, tag: &str, msg: &str)
pub fn log(&self, level: LogLevel, tag: &str, msg: &str)
Write a message to the logger’s active backend.
Release-mode level stripping is applied here, matching the free
log function (CORE-M14): a caller-built Logger must not bypass
the documented release strip and let Verbose..Warn — including
attacker-controlled strings — reach the backend in release builds.
Trait Implementations§
impl Copy for Logger
impl Eq for Logger
impl StructuralPartialEq for Logger
Auto Trait Implementations§
impl Freeze for Logger
impl RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl UnsafeUnpin for Logger
impl UnwindSafe for Logger
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