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§
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");