Skip to content

Commit

Permalink
Reduce the chattiness of atril daemon
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gcampax authored and raveit65 committed Oct 25, 2018
1 parent c9ea2a3 commit a6fc396
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions shell/ev-daemon.c
Expand Up @@ -21,6 +21,7 @@

#include "config.h"

#define G_LOG_DOMAIN "AtrilDaemon"
#include <glib.h>
#include <glib/gstdio.h>
#include <gio/gio.h>
Expand All @@ -41,7 +42,7 @@

#define DAEMON_TIMEOUT (30) /* seconds */

#define LOG g_printerr
#define LOG g_debug


#define EV_TYPE_DAEMON_APPLICATION (ev_daemon_application_get_type ())
Expand Down Expand Up @@ -136,7 +137,7 @@ name_appeared_cb (GDBusConnection *connection,
const gchar *name_owner,
gpointer user_data)
{
LOG ("Watch name'%s' appeared with owner '%s'\n", name, name_owner);
LOG ("Watch name'%s' appeared with owner '%s'", name, name_owner);
}

static void
Expand All @@ -147,15 +148,15 @@ name_vanished_cb (GDBusConnection *connection,
EvDaemonApplication *application = EV_DAEMON_APPLICATION (user_data);
GList *l;

LOG ("Watch name'%s' disappeared\n", name);
LOG ("Watch name'%s' disappeared", name);

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

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

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

application->docs = g_list_delete_link (application->docs, l);
ev_doc_free (doc);
Expand All @@ -174,7 +175,7 @@ process_pending_invocations (EvDaemonApplication *application,
GList *l;
GList *uri_invocations;

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

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

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

return TRUE;
Expand All @@ -233,7 +234,7 @@ handle_register_document_cb (EvDaemon *object,
sender = g_dbus_method_invocation_get_sender (invocation);
connection = g_dbus_method_invocation_get_connection (invocation);

LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", sender, uri);
LOG ("RegisterDocument registered owner '%s' for URI '%s'", sender, uri);

doc = g_new (EvDoc, 1);
doc->dbus_name = g_strdup (sender);
Expand Down Expand Up @@ -273,11 +274,11 @@ handle_unregister_document_cb (EvDaemon *object,
EvDoc *doc;
const char *sender;

LOG ("UnregisterDocument URI '%s'\n", uri);
LOG ("UnregisterDocument URI '%s'", uri);

doc = ev_daemon_application_find_doc (application, uri);
if (doc == NULL) {
LOG ("UnregisterDocument URI was not registered!\n");
LOG ("UnregisterDocument URI was not registered!");
g_dbus_method_invocation_return_error_literal (invocation,
G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
Expand All @@ -287,7 +288,7 @@ handle_unregister_document_cb (EvDaemon *object,

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

g_dbus_method_invocation_return_error_literal (invocation,
Expand Down Expand Up @@ -323,7 +324,7 @@ handle_find_document_cb (EvDaemon *object,
{
EvDoc *doc;

LOG ("FindDocument URI '%s' \n", uri);
LOG ("FindDocument URI '%s'", uri);

doc = ev_daemon_application_find_doc (application, uri);
if (doc != NULL) {
Expand Down Expand Up @@ -353,7 +354,7 @@ handle_find_document_cb (EvDaemon *object,
}
}

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

Expand Down

0 comments on commit a6fc396

Please sign in to comment.