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/Mapper.cxx | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/Mapper.cxx') 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 @@ -38,6 +40,8 @@ #include #include +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 -- cgit v1.2.3