glib

Macro g_error

Source
macro_rules! g_error {
    ($log_domain:expr, $format:literal, $($arg:expr),* $(,)?) => { ... };
    ($log_domain:expr, $format:literal $(,)?) => { ... };
}
Expand description

Macro used to log using GLib logging system. It uses g_log.

It is the same as calling the g_log! macro with LogLevel::Error.

Example:

use glib::g_error;

g_error!("test", "test");
// Equivalent to:
use glib::{g_log, LogLevel};
g_log!("test", LogLevel::Error, "test");

// trailing commas work as well:
g_error!("test", "test",);

// You can also pass arguments like in format! or println!:
let x = 12;
g_error!("test", "test: {}", x);
g_error!("test", "test: {} {}", x, "a");
// trailing commas work as well:
g_error!("test", "test: {} {}", x, "a",);