diff options
author | Simon McVittie <smcv@collabora.com> | 2022-12-14 15:18:51 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2022-12-15 16:45:35 +0000 |
commit | c2c034733ee77a639da66ae70788707c89e073fb (patch) | |
tree | 655828cc86934e2a38c1b2ec7ae5e44cd18665b1 | |
parent | 86c9d7d4c74167f4d7b102fec6d593251f2db7d8 (diff) | |
download | flatpak-c2c034733ee77a639da66ae70788707c89e073fb.tar.gz |
common: Make flatpak_debug2() use the same domain as g_debug()
Now that we are logging `flatpak -v` messages with log level INFO,
and printing INFO messages in the same way as DEBUG, we can reserve
log level DEBUG for `flatpak -v -v` messages. This means we no longer
need a weird secondary debug domain.
There is a very small behaviour change here: G_MESSAGES_DEBUG=flatpak
is now similar to `flatpak -v -v` (previously `flatpak -v`), and
G_MESSAGES_DEBUG=flatpak2 no longer has any effect. This seems more in
line with what would be expected from a GLib-based application.
In flatpak(1) and the system helper, this does not change behaviour
other than that: the same messages are logged by `-v` and by `-v -v`
as before.
In daemons that do not implement `-v -v` (the OCI authenticator, portal
and session helper), it continues to be necessary to use
G_MESSAGES_DEBUG to see flatpak_debug2() messages.
Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r-- | app/flatpak-main.c | 4 | ||||
-rw-r--r-- | common/flatpak-utils-private.h | 3 | ||||
-rw-r--r-- | common/flatpak-utils.c | 12 | ||||
-rw-r--r-- | oci-authenticator/flatpak-oci-authenticator.c | 2 | ||||
-rw-r--r-- | portal/flatpak-portal.c | 2 | ||||
-rw-r--r-- | session-helper/flatpak-session-helper.c | 2 | ||||
-rw-r--r-- | system-helper/flatpak-system-helper.c | 4 | ||||
-rw-r--r-- | tests/test-authenticator.c | 2 |
8 files changed, 9 insertions, 22 deletions
diff --git a/app/flatpak-main.c b/app/flatpak-main.c index a053af19..343869dc 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -358,9 +358,9 @@ flatpak_option_context_parse (GOptionContext *context, else { if (opt_verbose > 0) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); if (opt_verbose > 1) - g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); if (opt_ostree_verbose) g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); diff --git a/common/flatpak-utils-private.h b/common/flatpak-utils-private.h index 7829d998..b937c274 100644 --- a/common/flatpak-utils-private.h +++ b/common/flatpak-utils-private.h @@ -102,8 +102,7 @@ gboolean flatpak_fail_error (GError **error, const char *fmt, ...) G_GNUC_PRINTF (3, 4); -void flatpak_debug2 (const char *format, - ...) G_GNUC_PRINTF (1, 2); +#define flatpak_debug2(...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, __VA_ARGS__) gint flatpak_strcmp0_ptr (gconstpointer a, gconstpointer b); diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index df149932..799e399f 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -120,18 +120,6 @@ flatpak_fail_error (GError **error, FlatpakError code, const char *fmt, ...) return FALSE; } -void -flatpak_debug2 (const char *format, ...) -{ - va_list var_args; - - va_start (var_args, format); - g_logv (G_LOG_DOMAIN "2", - G_LOG_LEVEL_DEBUG, - format, var_args); - va_end (var_args); -} - gboolean flatpak_write_update_checksum (GOutputStream *out, gconstpointer data, diff --git a/oci-authenticator/flatpak-oci-authenticator.c b/oci-authenticator/flatpak-oci-authenticator.c index ece39e35..7053423c 100644 --- a/oci-authenticator/flatpak-oci-authenticator.c +++ b/oci-authenticator/flatpak-oci-authenticator.c @@ -765,7 +765,7 @@ main (int argc, } if (opt_verbose) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); g_info ("Started flatpak-authenticator"); diff --git a/portal/flatpak-portal.c b/portal/flatpak-portal.c index 364ffb17..41758fc3 100644 --- a/portal/flatpak-portal.c +++ b/portal/flatpak-portal.c @@ -3037,7 +3037,7 @@ main (int argc, } if (opt_verbose) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); client_pid_data_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) pid_data_free); diff --git a/session-helper/flatpak-session-helper.c b/session-helper/flatpak-session-helper.c index 4c02739a..40cb7bdc 100644 --- a/session-helper/flatpak-session-helper.c +++ b/session-helper/flatpak-session-helper.c @@ -826,7 +826,7 @@ main (int argc, } if (verbose) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); client_pid_data_hash = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) pid_data_free); diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c index 91d52b4c..13a7b3b2 100644 --- a/system-helper/flatpak-system-helper.c +++ b/system-helper/flatpak-system-helper.c @@ -2373,9 +2373,9 @@ main (int argc, flatpak_disable_fancy_output (); if (opt_verbose > 0) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); if (opt_verbose > 1) - g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); if (opt_ostree_verbose) g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); diff --git a/tests/test-authenticator.c b/tests/test-authenticator.c index 4ccd471f..521ded44 100644 --- a/tests/test-authenticator.c +++ b/tests/test-authenticator.c @@ -372,7 +372,7 @@ main (int argc, } if (opt_verbose) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL); g_info ("Started test-authenticator"); |