diff options
author | Colin Walters <walters@verbum.org> | 2013-11-07 15:13:27 -0500 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2013-11-08 09:36:12 +0000 |
commit | 7dbbecc05ff08d665890f1c1535df7eaa022b79a (patch) | |
tree | 4e5d04c5376aebfc37659f3ded236ec24c6a5158 | |
parent | ea0a654facc8a99631cca12b8b073fd7a4e0e58b (diff) | |
download | colord-7dbbecc05ff08d665890f1c1535df7eaa022b79a.tar.gz |
main: Only syslog() profile additions when they're added via DBus
Currently we syslog 24 totally useless log messages about "Profile
added: <checksum>" on every boot. This is a major offender in bootup
log spew.
I wrote this patch so that we do still log profile additions when a
client requests them via DBus, but we really shouldn't log about stuff
we just found on disk in the system ICC store.
Signed-off-by: Richard Hughes <richard@hughsie.com>
-rw-r--r-- | src/cd-main.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/cd-main.c b/src/cd-main.c index d1185bb..07248ed 100644 --- a/src/cd-main.c +++ b/src/cd-main.c @@ -791,12 +791,19 @@ out: g_object_unref (device); } +typedef enum { + CD_LOGGING_FLAG_NONE = 0, + CD_LOGGING_FLAG_SYSLOG = 1, + CD_LOGGING_FLAG_LAST +} CdLoggingFlags; + /** * cd_main_profile_register_on_bus: **/ static gboolean cd_main_profile_register_on_bus (CdMainPrivate *priv, CdProfile *profile, + CdLoggingFlags logging, GError **error) { gboolean ret; @@ -812,8 +819,10 @@ cd_main_profile_register_on_bus (CdMainPrivate *priv, /* emit signal */ g_debug ("CdMain: Emitting ProfileAdded(%s)", cd_profile_get_object_path (profile)); - syslog (LOG_INFO, "Profile added: %s", - cd_profile_get_id (profile)); + if ((logging & CD_LOGGING_FLAG_SYSLOG) > 0) { + syslog (LOG_INFO, "Profile added: %s", + cd_profile_get_id (profile)); + } g_dbus_connection_emit_signal (priv->connection, NULL, COLORD_DBUS_PATH, @@ -1661,7 +1670,10 @@ cd_main_daemon_method_call (GDBusConnection *connection, const gchar *sender, cd_main_profile_auto_add_from_md (priv, profile); /* register on bus */ - ret = cd_main_profile_register_on_bus (priv, profile, &error); + ret = cd_main_profile_register_on_bus (priv, + profile, + CD_LOGGING_FLAG_SYSLOG, + &error); if (!ret) { g_dbus_method_invocation_return_gerror (invocation, error); @@ -1808,7 +1820,10 @@ cd_main_icc_store_added_cb (CdIccStore *icc_store, } /* register on bus */ - ret = cd_main_profile_register_on_bus (priv, profile, &error); + ret = cd_main_profile_register_on_bus (priv, + profile, + CD_LOGGING_FLAG_NONE, + &error); if (!ret) { g_warning ("CdMain: failed to emit ProfileAdded: %s", error->message); |