Skip to content

main: Treat g_info() as equivalent to g_debug() - #5218

Merged
smcv merged 2 commits into
flatpak:mainfrom
smcv:g-info
Dec 14, 2022
Merged

smcv merged 2 commits into
flatpak:mainfrom
smcv:g-info

Conversation

@smcv

@smcv smcv commented Dec 14, 2022 •

Copy link
Copy Markdown
Collaborator
  • 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: [Feature request]: Switch to g_info() for --verbose messages #5001

  • daemons: Treat g_info() as equivalent to g_debug()

    Same as the previous commit, but for anything that runs in the
    background.


I want this as a starting point for #5001, but I've written this first so that I can already use G_LOG_LEVEL_INFO in #5213.

To test, apply this:

diff --git a/app/flatpak-builtins-ps.c b/app/flatpak-builtins-ps.c
index dd6d4686..4015f565 100644
--- a/app/flatpak-builtins-ps.c
+++ b/app/flatpak-builtins-ps.c
@@ -253,6 +253,10 @@ flatpak_builtin_ps (int           argc,
       return FALSE;
     }
 
+  g_info ("info");
+  g_debug ("debug");
+  flatpak_debug2 ("debug2");
+
   columns = handle_column_args (all_columns, FALSE, opt_cols, error);
   if (columns == NULL)
     return FALSE;

and run flatpak ps, flatpak ps -v, flatpak ps -v -v. The expected result is that debug2 only appears with -v -v, info appears with at least -v, and the status of debug is going to change during #5001 but at the moment it appears with at least -v.

@TingPing TingPing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to move towards using G_LOG_LEVEL_INFO for flatpak -v messages, and G_LOG_LEVEL_DEBUG for
flapak -v -v

This sounds good.

smcv added 2 commits December 14, 2022 20:01
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: flatpak#5001
Signed-off-by: Simon McVittie <[email protected]>
Same as the previous commit, but for anything that runs in the
background.

Signed-off-by: Simon McVittie <[email protected]>
@smcv
smcv merged commit ea584ac into flatpak:main Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants