[gnome-online-accounts/wip/goautils-debug-prints] goautils: Turn runtime warnings into debug prints, which they really are




commit b9b8c557903694057ea755a8f6f64f603216c054
Author: Milan Crha <mcrha redhat com>
Date:   Fri Jul 22 09:21:36 2022 +0200

    goautils: Turn runtime warnings into debug prints, which they really are
    
    These warnings are aimed for debugging. They needlessly clutter users'
    journal logs, because the code can gracefully handle these errors.

 src/goabackend/goautils.c | 114 +++++++++++++++++++++++-----------------------
 1 file changed, 57 insertions(+), 57 deletions(-)
---
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 70d66a6e..fca5dcfe 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -363,7 +363,7 @@ goa_utils_delete_credentials_for_id_sync (GoaProvider   *provider,
                               NULL);
   if (sec_error != NULL)
     {
-      g_warning ("secret_password_clear_sync() failed: %s", sec_error->message);
+      g_debug ("secret_password_clear_sync() failed: %s", sec_error->message);
       g_set_error_literal (error,
                            GOA_ERROR,
                            GOA_ERROR_FAILED, /* TODO: more specific */
@@ -411,7 +411,7 @@ goa_utils_lookup_credentials_sync (GoaProvider   *provider,
                                           NULL);
   if (sec_error != NULL)
     {
-      g_warning ("secret_password_lookup_sync() failed: %s", sec_error->message);
+      g_debug ("secret_password_lookup_sync() failed: %s", sec_error->message);
       g_set_error_literal (error,
                            GOA_ERROR,
                            GOA_ERROR_FAILED, /* TODO: more specific */
@@ -421,7 +421,7 @@ goa_utils_lookup_credentials_sync (GoaProvider   *provider,
     }
   else if (password == NULL)
     {
-      g_warning ("secret_password_lookup_sync() returned NULL");
+      g_debug ("secret_password_lookup_sync() returned NULL");
       g_set_error_literal (error,
                            GOA_ERROR,
                            GOA_ERROR_FAILED, /* TODO: more specific */
@@ -492,7 +492,7 @@ goa_utils_store_credentials_for_id_sync (GoaProvider   *provider,
                                    "goa-identity", password_key,
                                    NULL))
     {
-      g_warning ("secret_password_store_sync() failed: %s", sec_error->message);
+      g_debug ("secret_password_store_sync() failed: %s", sec_error->message);
       g_set_error_literal (error,
                            GOA_ERROR,
                            GOA_ERROR_FAILED, /* TODO: more specific */
@@ -545,11 +545,11 @@ goa_utils_keyfile_copy_group (GKeyFile     *src_key_file,
   keys = g_key_file_get_keys (src_key_file, src_group_name, NULL, &error);
   if (error != NULL)
     {
-      g_warning ("Error getting keys from group %s: %s (%s, %d)",
-                 src_group_name,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error getting keys from group %s: %s (%s, %d)",
+               src_group_name,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       g_error_free (error);
       goto out;
     }
@@ -563,12 +563,12 @@ goa_utils_keyfile_copy_group (GKeyFile     *src_key_file,
       src_value = g_key_file_get_value (src_key_file, src_group_name, keys[i], &error);
       if (error != NULL)
         {
-          g_warning ("Error reading key %s from group %s: %s (%s, %d)",
-                     keys[i],
-                     src_group_name,
-                     error->message,
-                     g_quark_to_string (error->domain),
-                     error->code);
+          g_debug ("Error reading key %s from group %s: %s (%s, %d)",
+                   keys[i],
+                   src_group_name,
+                   error->message,
+                   g_quark_to_string (error->domain),
+                   error->code);
           g_error_free (error);
           continue;
         }
@@ -580,12 +580,12 @@ goa_utils_keyfile_copy_group (GKeyFile     *src_key_file,
           if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)
               && !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
             {
-              g_warning ("Error reading key %s from group %s: %s (%s, %d)",
-                         keys[i],
-                         src_group_name,
-                         error->message,
-                         g_quark_to_string (error->domain),
-                         error->code);
+              g_debug ("Error reading key %s from group %s: %s (%s, %d)",
+                       keys[i],
+                       src_group_name,
+                       error->message,
+                       g_quark_to_string (error->domain),
+                       error->code);
             }
 
           g_error_free (error);
@@ -618,12 +618,12 @@ goa_utils_keyfile_get_boolean (GKeyFile *key_file, const gchar *group_name, cons
     {
       if (!g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND))
         {
-          g_warning ("Error reading key %s from group %s in keyfile: %s (%s, %d)",
-                     key,
-                     group_name,
-                     error->message,
-                     g_quark_to_string (error->domain),
-                     error->code);
+          g_debug ("Error reading key %s from group %s in keyfile: %s (%s, %d)",
+                   key,
+                   group_name,
+                   error->message,
+                   g_quark_to_string (error->domain),
+                   error->code);
         }
 
       g_error_free (error);
@@ -650,11 +650,11 @@ goa_utils_keyfile_remove_key (GoaAccount *account, const gchar *key)
                                   G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
                                   &error))
     {
-      g_warning ("Error loading keyfile %s: %s (%s, %d)",
-                 path,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error loading keyfile %s: %s (%s, %d)",
+               path,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       g_error_free (error);
       goto out;
     }
@@ -666,7 +666,7 @@ goa_utils_keyfile_remove_key (GoaAccount *account, const gchar *key)
   if (!g_key_file_save_to_file (key_file, path, &error))
     {
       g_prefix_error (&error, "Error writing key-value-file %s: ", path);
-      g_warning ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
+      g_debug ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
       g_error_free (error);
       goto out;
     }
@@ -697,11 +697,11 @@ goa_utils_keyfile_set_boolean (GoaAccount *account, const gchar *key, gboolean v
                                   G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
                                   &error))
     {
-      g_warning ("Error loading keyfile %s: %s (%s, %d)",
-                 path,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error loading keyfile %s: %s (%s, %d)",
+               path,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       g_error_free (error);
       goto out;
     }
@@ -710,12 +710,12 @@ goa_utils_keyfile_set_boolean (GoaAccount *account, const gchar *key, gboolean v
   old_value = g_key_file_get_boolean (key_file, group, key, &error);
   if (error != NULL)
     {
-      g_warning ("Error reading key %s from keyfile %s: %s (%s, %d)",
-                 key,
-                 path,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error reading key %s from keyfile %s: %s (%s, %d)",
+               key,
+               path,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       needs_update = TRUE;
       g_error_free (error);
     }
@@ -733,7 +733,7 @@ goa_utils_keyfile_set_boolean (GoaAccount *account, const gchar *key, gboolean v
   if (!g_key_file_save_to_file (key_file, path, &error))
     {
       g_prefix_error (&error, "Error writing key-value-file %s: ", path);
-      g_warning ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
+      g_debug ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
       g_error_free (error);
       goto out;
     }
@@ -764,11 +764,11 @@ goa_utils_keyfile_set_string (GoaAccount *account, const gchar *key, const gchar
                                   G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
                                   &error))
     {
-      g_warning ("Error loading keyfile %s: %s (%s, %d)",
-                 path,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error loading keyfile %s: %s (%s, %d)",
+               path,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       g_error_free (error);
       goto out;
     }
@@ -777,12 +777,12 @@ goa_utils_keyfile_set_string (GoaAccount *account, const gchar *key, const gchar
   old_value = g_key_file_get_string (key_file, group, key, &error);
   if (error != NULL)
     {
-      g_warning ("Error reading key %s from keyfile %s: %s (%s, %d)",
-                 key,
-                 path,
-                 error->message,
-                 g_quark_to_string (error->domain),
-                 error->code);
+      g_debug ("Error reading key %s from keyfile %s: %s (%s, %d)",
+               key,
+               path,
+               error->message,
+               g_quark_to_string (error->domain),
+               error->code);
       needs_update = TRUE;
       g_error_free (error);
     }
@@ -800,7 +800,7 @@ goa_utils_keyfile_set_string (GoaAccount *account, const gchar *key, const gchar
   if (!g_key_file_save_to_file (key_file, path, &error))
     {
       g_prefix_error (&error, "Error writing key-value-file %s: ", path);
-      g_warning ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
+      g_debug ("%s (%s, %d)", error->message, g_quark_to_string (error->domain), error->code);
       g_error_free (error);
       goto out;
     }


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