Struct obs_wrapper::log::Logger
source · [−]pub struct Logger { /* private fields */ }Expand description
A logger that plugs into OBS’s logging system.
Since OBS only has 4 logging levels and the lowest level is
only enabled in debug builds of OBS, this logger provides a option
to promote lower-level logs as info.
You can also use any other logger implementation, but we recommend this since OBS also writes everything in its logging system to a file, which can be viewed if there is a problem and OBS is not started from a console.
Examples
A new logger with default settings.
let _ = Logger::new().init();Implementations
sourceimpl Logger
impl Logger
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new logger with default levle set to Level::Trace and does
not promote debug logs.
sourcepub fn init(self) -> Result<(), SetLoggerError>
pub fn init(self) -> Result<(), SetLoggerError>
Initializes this logger, setting this as the global logger. This MUST be called to be effective. This may fail if there is already a logger.
sourcepub fn with_promote_debug(self, promote_debug: bool) -> Self
pub fn with_promote_debug(self, promote_debug: bool) -> Self
Sets whether to promote Level::Debug and Level::Trace logs.
sourcepub fn with_max_level(self, max_level: LevelFilter) -> Self
pub fn with_max_level(self, max_level: LevelFilter) -> Self
Sets the maximum logging level.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl UnwindSafe for Logger
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more