[gnome-software] trivial: Do not log the cancelled messages to the journal



commit a164642f0da424e212c0c6c9144c500743d42c86
Author: Richard Hughes <richard hughsie com>
Date:   Tue May 23 11:44:42 2017 +0100

    trivial: Do not log the cancelled messages to the journal
    
    Search-as-you-type generates lots of these and they are just noise.

 lib/gs-plugin-loader.c |   12 ++++++++----
 src/gs-shell.c         |   13 +++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index aca99b5..07664f6 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -398,10 +398,14 @@ gs_plugin_error_handle_failure (GsPluginLoaderHelper *helper,
 
        /* fallback to console warning */
        if ((flags & GS_PLUGIN_FAILURE_FLAGS_NO_CONSOLE) == 0) {
-               g_warning ("failed to call %s on %s: %s",
-                          helper->function_name,
-                          gs_plugin_get_name (plugin),
-                          error_local->message);
+               if (!g_error_matches (error_local,
+                                     GS_PLUGIN_ERROR,
+                                     GS_PLUGIN_ERROR_CANCELLED)) {
+                       g_warning ("failed to call %s on %s: %s",
+                                  helper->function_name,
+                                  gs_plugin_get_name (plugin),
+                                  error_local->message);
+               }
        }
 
        return TRUE;
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 681869c..2b1808c 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -1537,10 +1537,15 @@ gs_shell_rescan_events (GsShell *shell)
                if (!gs_shell_show_event (shell, event)) {
                        GsPluginAction action = gs_plugin_event_get_action (event);
                        const GError *error = gs_plugin_event_get_error (event);
-                       g_warning ("not handling error %s for action %s: %s",
-                                  gs_plugin_error_to_string (error->code),
-                                  gs_plugin_action_to_string (action),
-                                  error->message);
+                       if (error != NULL &&
+                           !g_error_matches (error,
+                                             GS_PLUGIN_ERROR,
+                                             GS_PLUGIN_ERROR_CANCELLED)) {
+                               g_warning ("not handling error %s for action %s: %s",
+                                          gs_plugin_error_to_string (error->code),
+                                          gs_plugin_action_to_string (action),
+                                          error->message);
+                       }
                        gs_plugin_event_add_flag (event, GS_PLUGIN_EVENT_FLAG_INVALID);
                        return;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]