pub struct GlibLogger { /* private fields */ }
Available on crate feature
log
only.Expand description
An implementation of a log
compatible
logger which logs over glib logging facilities.
In order to use this type, glib
must be built with the log
feature
enabled.
Use this if you want to use glib as the main logging output in your application,
and want to route all logging happening through the log crate to glib logging.
If you want the opposite, see
rust_log_handler
.
NOTE: This should never be used when
rust_log_handler
has
been registered as a default glib log handler, otherwise a stack overflow
will occur.
Example:
static glib_logger: glib::GlibLogger = glib::GlibLogger::new(
glib::GlibLoggerFormat::Plain,
glib::GlibLoggerDomain::CrateTarget,
);
log::set_logger(&glib_logger);
log::set_max_level(log::LevelFilter::Debug);
log::info!("This line will get logged by glib");
Implementations§
Source§impl GlibLogger
impl GlibLogger
Sourcepub const fn new(format: GlibLoggerFormat, domain: GlibLoggerDomain) -> Self
pub const fn new(format: GlibLoggerFormat, domain: GlibLoggerDomain) -> Self
Creates a new instance of GlibLogger
.
See documentation of GlibLogger
for more
information.
Example:
static glib_logger: glib::GlibLogger = glib::GlibLogger::new(
glib::GlibLoggerFormat::Plain,
glib::GlibLoggerDomain::CrateTarget,
);
log::set_logger(&glib_logger);
log::set_max_level(log::LevelFilter::Debug);
log::info!("This line will get logged by glib");
Trait Implementations§
Source§impl Debug for GlibLogger
impl Debug for GlibLogger
Auto Trait Implementations§
impl Freeze for GlibLogger
impl RefUnwindSafe for GlibLogger
impl Send for GlibLogger
impl Sync for GlibLogger
impl Unpin for GlibLogger
impl UnwindSafe for GlibLogger
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