Commit 0644f989 authored by Sophie Herold's avatar Sophie Herold 🏳️‍🌈
Browse files

logging: Output path and new log domain convention

parent 8f479828
Pipeline #375728 failed with stages
in 12 minutes and 22 seconds
......@@ -44,9 +44,11 @@ Outside of GNOME Builder the flatpak manifests depend on the generated `generate
The log level can be adjusted by setting the `G_MESSAGES_DEBUG` to `all`. For example
```sh
$ G_MESSAGES_DEBUG=all cargo run
$ G_MESSAGES_PREFIXED="" G_MESSAGES_DEBUG=all cargo run
```
Currently, `pika-backup` and `pika-backup-trace` are used as logging domains. You can use `G_MESSAGES_DEBUG=pika-backup` to get debug, but no trace output.
See ["Running GLib Applications"](https://developer.gnome.org/glib/stable/glib-running.html) for more options.
## Building manually
......
......@@ -123,34 +123,42 @@ where
#[macro_export]
macro_rules! error {
($($arg:tt)+) => (
glib::g_log!(module_path!(), glib::LogLevel::Critical, $($arg)+)
generic!("", glib::LogLevel::Critical, $($arg)+)
)
}
#[macro_export]
macro_rules! warn {
($($arg:tt)+) => (
glib::g_log!(module_path!(), glib::LogLevel::Warning, $($arg)+)
generic!("", glib::LogLevel::Warning, $($arg)+)
)
}
#[macro_export]
macro_rules! info {
($($arg:tt)+) => (
glib::g_log!(module_path!(), glib::LogLevel::Info, $($arg)+)
generic!("", glib::LogLevel::Info, $($arg)+)
)
}
#[macro_export]
macro_rules! debug {
($($arg:tt)+) => (
glib::g_log!(module_path!(), glib::LogLevel::Debug, $($arg)+)
generic!("", glib::LogLevel::Debug, $($arg)+)
)
}
#[macro_export]
macro_rules! trace {
($($arg:tt)+) => (
glib::g_log!(module_path!(), glib::LogLevel::Debug, $($arg)+)
generic!("-trace", glib::LogLevel::Debug, $($arg)+)
)
}
#[macro_export]
macro_rules! generic {
($suffix:tt, $level:expr, $($arg:tt)*) => (
let domain = env!("CARGO_PKG_NAME").to_string() + $suffix;
glib::g_log!(domain.as_str(), $level, "{}:{}:0: {}", file!(), line!(), format!($($arg)+))
)
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment