diff options
author | Max Kellermann <max@duempel.org> | 2013-09-27 22:31:24 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-02 08:57:55 +0200 |
commit | 060814daa83f6a94f5934464ae42a406c5c7e947 (patch) | |
tree | f636ec6cdbb8e52fda6db987d2a28fc73c7b94b4 /src/InotifyUpdate.cxx | |
parent | c53492a76a8a05825e1c7f699c05645eee891199 (diff) | |
download | mpd-060814daa83f6a94f5934464ae42a406c5c7e947.tar.gz mpd-060814daa83f6a94f5934464ae42a406c5c7e947.tar.xz mpd-060814daa83f6a94f5934464ae42a406c5c7e947.zip |
Log: new logging library API
Prepare to migrate away from GLib. Currently, we're still using GLib
as a backend.
Diffstat (limited to '')
-rw-r--r-- | src/InotifyUpdate.cxx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/InotifyUpdate.cxx b/src/InotifyUpdate.cxx index cccb9650c..d65ff31f3 100644 --- a/src/InotifyUpdate.cxx +++ b/src/InotifyUpdate.cxx @@ -21,10 +21,12 @@ #include "InotifyUpdate.hxx" #include "InotifySource.hxx" #include "InotifyQueue.hxx" +#include "InotifyDomain.hxx" #include "Mapper.hxx" #include "Main.hxx" #include "fs/Path.hxx" #include "util/Error.hxx" +#include "Log.hxx" #include <glib.h> @@ -36,10 +38,6 @@ #include <sys/stat.h> #include <string.h> #include <dirent.h> -#include <errno.h> - -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "inotify" enum { IN_MASK = IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE|IN_DELETE_SELF @@ -120,8 +118,9 @@ remove_watch_directory(WatchDirectory *directory) assert(directory != NULL); if (directory->parent == NULL) { - g_warning("music directory was removed - " - "cannot continue to watch it"); + LogWarning(inotify_domain, + "music directory was removed - " + "cannot continue to watch it"); return; } @@ -178,8 +177,8 @@ recursive_watch_subdirectories(WatchDirectory *directory, dir = opendir(path_fs); if (dir == NULL) { - g_warning("Failed to open directory %s: %s", - path_fs, g_strerror(errno)); + FormatErrno(inotify_domain, + "Failed to open directory %s", path_fs); return; } @@ -194,8 +193,9 @@ recursive_watch_subdirectories(WatchDirectory *directory, child_path_fs = g_strconcat(path_fs, "/", ent->d_name, NULL); ret = stat(child_path_fs, &st); if (ret < 0) { - g_warning("Failed to stat %s: %s", - child_path_fs, g_strerror(errno)); + FormatErrno(inotify_domain, + "Failed to stat %s", + child_path_fs); g_free(child_path_fs); continue; } @@ -207,8 +207,8 @@ recursive_watch_subdirectories(WatchDirectory *directory, ret = inotify_source->Add(child_path_fs, IN_MASK, error); if (ret < 0) { - g_warning("Failed to register %s: %s", - child_path_fs, error.GetMessage()); + FormatError(error, + "Failed to register %s", child_path_fs); error.Clear(); g_free(child_path_fs); continue; @@ -253,7 +253,7 @@ mpd_inotify_callback(int wd, unsigned mask, WatchDirectory *directory; char *uri_fs; - /*g_debug("wd=%d mask=0x%x name='%s'", wd, mask, name);*/ + /*FormatDebug(inotify_domain, "wd=%d mask=0x%x name='%s'", wd, mask, name);*/ directory = tree_find_watch_directory(wd); if (directory == NULL) @@ -309,11 +309,11 @@ mpd_inotify_callback(int wd, unsigned mask, void mpd_inotify_init(unsigned max_depth) { - g_debug("initializing inotify"); + LogDebug(inotify_domain, "initializing inotify"); const Path &path = mapper_get_music_directory_fs(); if (path.IsNull()) { - g_debug("no music directory configured"); + LogDebug(inotify_domain, "no music directory configured"); return; } @@ -322,7 +322,7 @@ mpd_inotify_init(unsigned max_depth) mpd_inotify_callback, nullptr, error); if (inotify_source == NULL) { - g_warning("%s", error.GetMessage()); + LogError(error); return; } @@ -330,7 +330,7 @@ mpd_inotify_init(unsigned max_depth) int descriptor = inotify_source->Add(path.c_str(), IN_MASK, error); if (descriptor < 0) { - g_warning("%s", error.GetMessage()); + LogError(error); delete inotify_source; inotify_source = NULL; return; @@ -344,7 +344,7 @@ mpd_inotify_init(unsigned max_depth) inotify_queue = new InotifyQueue(*main_loop); - g_debug("watching music directory"); + LogDebug(inotify_domain, "watching music directory"); } void |