From 060814daa83f6a94f5934464ae42a406c5c7e947 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 27 Sep 2013 22:31:24 +0200 Subject: Log: new logging library API Prepare to migrate away from GLib. Currently, we're still using GLib as a backend. --- src/UpdateGlue.cxx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/UpdateGlue.cxx') diff --git a/src/UpdateGlue.cxx b/src/UpdateGlue.cxx index 972842bb1..a4a47d468 100644 --- a/src/UpdateGlue.cxx +++ b/src/UpdateGlue.cxx @@ -22,11 +22,13 @@ #include "UpdateQueue.hxx" #include "UpdateWalk.hxx" #include "UpdateRemove.hxx" +#include "UpdateDomain.hxx" #include "Mapper.hxx" #include "DatabaseSimple.hxx" #include "Idle.hxx" #include "GlobalEvents.hxx" #include "util/Error.hxx" +#include "Log.hxx" extern "C" { #include "stats.h" @@ -40,9 +42,6 @@ extern "C" { #include -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "update" - static enum update_progress { UPDATE_PROGRESS_IDLE = 0, UPDATE_PROGRESS_RUNNING = 1, @@ -71,23 +70,22 @@ static void * update_task(void *_path) const char *path = (const char *)_path; if (path != NULL && *path != 0) - g_debug("starting: %s", path); + FormatDebug(update_domain, "starting: %s", path); else - g_debug("starting"); + LogDebug(update_domain, "starting"); modified = update_walk(path, discard); if (modified || !db_exists()) { Error error; if (!db_save(error)) - g_warning("Failed to save database: %s", - error.GetMessage()); + LogError(error, "Failed to save database"); } if (path != NULL && *path != 0) - g_debug("finished: %s", path); + FormatDebug(update_domain, "finished: %s", path); else - g_debug("finished"); + LogDebug(update_domain, "finished"); g_free(_path); progress = UPDATE_PROGRESS_DONE; @@ -104,7 +102,7 @@ spawn_update_task(const char *path) modified = false; #if GLIB_CHECK_VERSION(2,32,0) - update_thr = g_thread_new("updadte", update_task, g_strdup(path)); + update_thr = g_thread_new("update", update_task, g_strdup(path)); #else GError *e = NULL; update_thr = g_thread_create(update_task, g_strdup(path), TRUE, &e); @@ -114,7 +112,8 @@ spawn_update_task(const char *path) if (++update_task_id > update_task_id_max) update_task_id = 1; - g_debug("spawned thread for update job id %i", update_task_id); + FormatDebug(update_domain, + "spawned thread for update job id %i", update_task_id); } unsigned -- cgit v1.2.3