aboutsummaryrefslogtreecommitdiffstats
path: root/src/Log.hxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-09-27 22:31:24 +0200
committerMax Kellermann <max@duempel.org>2013-10-02 08:57:55 +0200
commit060814daa83f6a94f5934464ae42a406c5c7e947 (patch)
treef636ec6cdbb8e52fda6db987d2a28fc73c7b94b4 /src/Log.hxx
parentc53492a76a8a05825e1c7f699c05645eee891199 (diff)
downloadmpd-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 'src/Log.hxx')
-rw-r--r--src/Log.hxx96
1 files changed, 82 insertions, 14 deletions
diff --git a/src/Log.hxx b/src/Log.hxx
index 24cbe5c8d..719f1c448 100644
--- a/src/Log.hxx
+++ b/src/Log.hxx
@@ -20,27 +20,95 @@
#ifndef MPD_LOG_HXX
#define MPD_LOG_HXX
+#include "gcc.h"
+
+#ifdef WIN32
+#include <windows.h>
+/* damn you, windows.h! */
+#ifdef ERROR
+#undef ERROR
+#endif
+#endif
+
class Error;
+class Domain;
+
+enum class LogLevel {
+ DEBUG,
+ INFO,
+ WARNING,
+ ERROR,
+};
+
+void
+Log(const Domain &domain, LogLevel level, const char *msg);
+
+gcc_fprintf_
+void
+LogFormat(const Domain &domain, LogLevel level, const char *fmt, ...);
+
+static inline void
+LogDebug(const Domain &domain, const char *msg)
+{
+ Log(domain, LogLevel::DEBUG, msg);
+}
+
+gcc_fprintf
+void
+FormatDebug(const Domain &domain, const char *fmt, ...);
+
+static inline void
+LogInfo(const Domain &domain, const char *msg)
+{
+ Log(domain, LogLevel::INFO, msg);
+}
+
+gcc_fprintf
+void
+FormatInfo(const Domain &domain, const char *fmt, ...);
+
+static inline void
+LogWarning(const Domain &domain, const char *msg)
+{
+ Log(domain, LogLevel::WARNING, msg);
+}
+
+gcc_fprintf
+void
+FormatWarning(const Domain &domain, const char *fmt, ...);
+
+static inline void
+LogError(const Domain &domain, const char *msg)
+{
+ Log(domain, LogLevel::ERROR, msg);
+}
+
+gcc_fprintf
+void
+FormatError(const Domain &domain, const char *fmt, ...);
-/**
- * Configure a logging destination for daemon startup, before the
- * configuration file is read. This allows the daemon to use the
- * logging library (and the command line verbose level) before it's
- * daemonized.
- *
- * @param verbose true when the program is started with --verbose
- */
void
-log_early_init(bool verbose);
+LogError(const Error &error);
-bool
-log_init(bool verbose, bool use_stdout, Error &error);
+void
+LogError(const Error &error, const char *msg);
+
+gcc_fprintf
+void
+FormatError(const Error &error, const char *fmt, ...);
void
-log_deinit(void);
+LogErrno(const Domain &domain, int e, const char *msg);
-void setup_log_output(bool use_stdout);
+void
+LogErrno(const Domain &domain, const char *msg);
-int cycle_log_files(void);
+gcc_fprintf_
+void
+FormatErrno(const Domain &domain, int e, const char *fmt, ...);
+
+gcc_fprintf
+void
+FormatErrno(const Domain &domain, const char *fmt, ...);
#endif /* LOG_H */