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/Mapper.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/Mapper.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/Mapper.cxx b/src/Mapper.cxx index 135621e17..e2d082122 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -28,6 +28,8 @@ #include "fs/Path.hxx" #include "fs/FileSystem.hxx" #include "fs/DirectoryReader.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> @@ -38,6 +40,8 @@ #include <errno.h> #include <dirent.h> +static constexpr Domain mapper_domain("mapper"); + /** * The absolute path of the music directory encoded in UTF-8. */ @@ -57,12 +61,6 @@ static size_t music_dir_fs_length; */ static Path playlist_dir_fs = Path::Null(); -static inline GQuark -mapper_quark() -{ - return g_quark_from_static_string ("mapper"); -} - /** * Duplicate a string, chop all trailing slashes. */ @@ -82,26 +80,30 @@ check_directory(const char *path_utf8, const Path &path_fs) { struct stat st; if (!StatFile(path_fs, st)) { - g_warning("Failed to stat directory \"%s\": %s", - path_utf8, g_strerror(errno)); + FormatErrno(mapper_domain, + "Failed to stat directory \"%s\"", + path_utf8); return; } if (!S_ISDIR(st.st_mode)) { - g_warning("Not a directory: %s", path_utf8); + FormatError(mapper_domain, + "Not a directory: %s", path_utf8); return; } #ifndef WIN32 const Path x = Path::Build(path_fs, "."); if (!StatFile(x, st) && errno == EACCES) - g_warning("No permission to traverse (\"execute\") directory: %s", - path_utf8); + FormatError(mapper_domain, + "No permission to traverse (\"execute\") directory: %s", + path_utf8); #endif const DirectoryReader reader(path_fs); if (reader.HasFailed() && errno == EACCES) - g_warning("No permission to read directory: %s", path_utf8); + FormatError(mapper_domain, + "No permission to read directory: %s", path_utf8); } static void |