Struct glib::GlibLogger
source · [−]pub struct GlibLogger { /* private fields */ }
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
sourceimpl 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
sourceimpl Debug for GlibLogger
impl Debug for GlibLogger
Auto Trait Implementations
impl RefUnwindSafe for GlibLogger
impl Send for GlibLogger
impl Sync for GlibLogger
impl Unpin for GlibLogger
impl UnwindSafe for GlibLogger
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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