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§
Source§impl 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.