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

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

Formats the value using the given formatter. Read more

Determines if a log message with the specified metadata would be logged. Read more

Logs the Record. Read more

Flushes any buffered records.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.