From ac4e322629c2a11fd921fc2977bb29f18d072ad3 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 14 Dec 2022 13:14:34 +0000 Subject: [PATCH] main: Treat g_info() as equivalent to g_debug() This makes us consistent with the default behaviour of GLib, and its behaviour with G_MESSAGES_DEBUG=all. g_debug() and g_info() are the two lowest priority levels, and GLib normally silences them by default. At the moment, Flatpak uses G_LOG_LEVEL_DEBUG in the flatpak2 domain as its lowest-priority log level (only shown with flatpak -v -v), and G_LOG_LEVEL_DEBUG in the flatpak domain as its second-lowest (shown with flatpak -v or higher). I want to move towards using G_LOG_LEVEL_INFO for flatpak -v messages, and G_LOG_LEVEL_DEBUG for flapak -v -v, so that we don't need a second log domain: this is a policy I've used successfully in Flatpak-derived Steam Runtime code. This change does not fully implement that policy, but gives us a migration path towards it, by allowing us to start using g_info() for flatpak -v messages. Helps: https://github.com/flatpak/flatpak/issues/5001 Signed-off-by: Simon McVittie --- app/flatpak-main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/flatpak-main.c b/app/flatpak-main.c index 38b31750..04518718 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -358,12 +358,12 @@ flatpak_option_context_parse (GOptionContext *context, else { if (opt_verbose > 0) - g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); if (opt_verbose > 1) - g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG, message_handler, NULL); + g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); if (opt_ostree_verbose) - g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG, message_handler, NULL); + g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL); if (opt_verbose > 0 || opt_ostree_verbose) flatpak_disable_fancy_output ();