Skip to content

Commit a6fc396

Browse files
gcampaxraveit65
authored andcommitted
Reduce the chattiness of atril daemon
Use g_debug instead of g_printerr for debug warnings that happen during normal operation. This way messages are suppressed, unless the G_MESSAGES_DEBUG variable is set, and we avoid filling everyone's journal with repetitive debugging info. https://bugzilla.gnome.org/show_bug.cgi?id=723972 origin commit: https://gitlab.gnome.org/GNOME/evince/commit/707725e fixes #315
1 parent c9ea2a3 commit a6fc396

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

shell/ev-daemon.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "config.h"
2323

24+
#define G_LOG_DOMAIN "AtrilDaemon"
2425
#include <glib.h>
2526
#include <glib/gstdio.h>
2627
#include <gio/gio.h>
@@ -41,7 +42,7 @@
4142

4243
#define DAEMON_TIMEOUT (30) /* seconds */
4344

44-
#define LOG g_printerr
45+
#define LOG g_debug
4546

4647

4748
#define EV_TYPE_DAEMON_APPLICATION (ev_daemon_application_get_type ())
@@ -136,7 +137,7 @@ name_appeared_cb (GDBusConnection *connection,
136137
const gchar *name_owner,
137138
gpointer user_data)
138139
{
139-
LOG ("Watch name'%s' appeared with owner '%s'\n", name, name_owner);
140+
LOG ("Watch name'%s' appeared with owner '%s'", name, name_owner);
140141
}
141142

142143
static void
@@ -147,15 +148,15 @@ name_vanished_cb (GDBusConnection *connection,
147148
EvDaemonApplication *application = EV_DAEMON_APPLICATION (user_data);
148149
GList *l;
149150

150-
LOG ("Watch name'%s' disappeared\n", name);
151+
LOG ("Watch name'%s' disappeared", name);
151152

152153
for (l = application->docs; l != NULL; l = l->next) {
153154
EvDoc *doc = (EvDoc *) l->data;
154155

155156
if (strcmp (doc->dbus_name, name) != 0)
156157
continue;
157158

158-
LOG ("Watch found URI '%s' for name; removing\n", doc->uri);
159+
LOG ("Watch found URI '%s' for name; removing", doc->uri);
159160

160161
application->docs = g_list_delete_link (application->docs, l);
161162
ev_doc_free (doc);
@@ -174,7 +175,7 @@ process_pending_invocations (EvDaemonApplication *application,
174175
GList *l;
175176
GList *uri_invocations;
176177

177-
LOG ("RegisterDocument process pending invocations for URI %s\n", uri);
178+
LOG ("RegisterDocument process pending invocations for URI %s", uri);
178179
uri_invocations = g_hash_table_lookup (application->pending_invocations, uri);
179180

180181
for (l = uri_invocations; l != NULL; l = l->next) {
@@ -224,7 +225,7 @@ handle_register_document_cb (EvDaemon *object,
224225

225226
doc = ev_daemon_application_find_doc (application, uri);
226227
if (doc != NULL) {
227-
LOG ("RegisterDocument found owner '%s' for URI '%s'\n", doc->dbus_name, uri);
228+
LOG ("RegisterDocument found owner '%s' for URI '%s'", doc->dbus_name, uri);
228229
ev_daemon_complete_register_document (object, invocation, doc->dbus_name);
229230

230231
return TRUE;
@@ -233,7 +234,7 @@ handle_register_document_cb (EvDaemon *object,
233234
sender = g_dbus_method_invocation_get_sender (invocation);
234235
connection = g_dbus_method_invocation_get_connection (invocation);
235236

236-
LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", sender, uri);
237+
LOG ("RegisterDocument registered owner '%s' for URI '%s'", sender, uri);
237238

238239
doc = g_new (EvDoc, 1);
239240
doc->dbus_name = g_strdup (sender);
@@ -273,11 +274,11 @@ handle_unregister_document_cb (EvDaemon *object,
273274
EvDoc *doc;
274275
const char *sender;
275276

276-
LOG ("UnregisterDocument URI '%s'\n", uri);
277+
LOG ("UnregisterDocument URI '%s'", uri);
277278

278279
doc = ev_daemon_application_find_doc (application, uri);
279280
if (doc == NULL) {
280-
LOG ("UnregisterDocument URI was not registered!\n");
281+
LOG ("UnregisterDocument URI was not registered!");
281282
g_dbus_method_invocation_return_error_literal (invocation,
282283
G_DBUS_ERROR,
283284
G_DBUS_ERROR_INVALID_ARGS,
@@ -287,7 +288,7 @@ handle_unregister_document_cb (EvDaemon *object,
287288

288289
sender = g_dbus_method_invocation_get_sender (invocation);
289290
if (strcmp (doc->dbus_name, sender) != 0) {
290-
LOG ("UnregisterDocument called by non-owner (owner '%s' sender '%s')\n",
291+
LOG ("UnregisterDocument called by non-owner (owner '%s' sender '%s')",
291292
doc->dbus_name, sender);
292293

293294
g_dbus_method_invocation_return_error_literal (invocation,
@@ -323,7 +324,7 @@ handle_find_document_cb (EvDaemon *object,
323324
{
324325
EvDoc *doc;
325326

326-
LOG ("FindDocument URI '%s' \n", uri);
327+
LOG ("FindDocument URI '%s'", uri);
327328

328329
doc = ev_daemon_application_find_doc (application, uri);
329330
if (doc != NULL) {
@@ -353,7 +354,7 @@ handle_find_document_cb (EvDaemon *object,
353354
}
354355
}
355356

356-
LOG ("FindDocument URI '%s' was not registered!\n", uri);
357+
LOG ("FindDocument URI '%s' was not registered!", uri);
357358
// FIXME: shouldn't this return an error then?
358359
ev_daemon_complete_find_document (object, invocation, "");
359360

0 commit comments

Comments
 (0)