MPD  0.20.6
Log.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_LOG_HXX
21 #define MPD_LOG_HXX
22 
23 #include "LogLevel.hxx"
24 #include "Compiler.h"
25 
26 #include <exception>
27 
28 class Domain;
29 
30 void
31 Log(const Domain &domain, LogLevel level, const char *msg);
32 
33 gcc_printf(3,4)
34 void
35 LogFormat(const Domain &domain, LogLevel level, const char *fmt, ...);
36 
37 static inline void
38 LogDebug(const Domain &domain, const char *msg)
39 {
40  Log(domain, LogLevel::DEBUG, msg);
41 }
42 
43 gcc_printf(2,3)
44 void
45 FormatDebug(const Domain &domain, const char *fmt, ...);
46 
47 static inline void
48 LogInfo(const Domain &domain, const char *msg)
49 {
50  Log(domain, LogLevel::INFO, msg);
51 }
52 
53 gcc_printf(2,3)
54 void
55 FormatInfo(const Domain &domain, const char *fmt, ...);
56 
57 static inline void
58 LogDefault(const Domain &domain, const char *msg)
59 {
60  Log(domain, LogLevel::DEFAULT, msg);
61 }
62 
63 gcc_printf(2,3)
64 void
65 FormatDefault(const Domain &domain, const char *fmt, ...);
66 
67 static inline void
68 LogWarning(const Domain &domain, const char *msg)
69 {
70  Log(domain, LogLevel::WARNING, msg);
71 }
72 
73 gcc_printf(2,3)
74 void
75 FormatWarning(const Domain &domain, const char *fmt, ...);
76 
77 static inline void
78 LogError(const Domain &domain, const char *msg)
79 {
80  Log(domain, LogLevel::ERROR, msg);
81 }
82 
83 void
84 LogError(const std::exception &e);
85 
86 void
87 LogError(const std::exception &e, const char *msg);
88 
89 gcc_printf(2,3)
90 void
91 FormatError(const std::exception &e, const char *fmt, ...);
92 
93 void
94 LogError(const std::exception_ptr &ep);
95 
96 void
97 LogError(const std::exception_ptr &ep, const char *msg);
98 
99 gcc_printf(2,3)
100 void
101 FormatError(const std::exception_ptr &ep, const char *fmt, ...);
102 
103 gcc_printf(2,3)
104 void
105 FormatError(const Domain &domain, const char *fmt, ...);
106 
107 void
108 LogErrno(const Domain &domain, int e, const char *msg);
109 
110 void
111 LogErrno(const Domain &domain, const char *msg);
112 
113 gcc_printf(3,4)
114 void
115 FormatErrno(const Domain &domain, int e, const char *fmt, ...);
116 
117 gcc_printf(2,3)
118 void
119 FormatErrno(const Domain &domain, const char *fmt, ...);
120 
121 #endif /* LOG_H */
An error has occurred, an operation could not finish successfully.
LogLevel const char * fmt
Definition: Log.hxx:35
LogLevel const char static void LogDebug(const Domain &domain, const char *msg)
Definition: Log.hxx:38
LogLevel level
Definition: Log.hxx:35
gcc_printf(2, 3) void FormatError(const std const char void LogErrno(const Domain &domain, int e, const char *msg)
const char static void LogDefault(const Domain &domain, const char *msg)
Definition: Log.hxx:58
const char static void LogWarning(const Domain &domain, const char *msg)
Definition: Log.hxx:68
const char static void LogInfo(const Domain &domain, const char *msg)
Definition: Log.hxx:48
void Log(const Domain &domain, LogLevel level, const char *msg)
Interesting informational message.
gcc_printf(3, 4) void LogFormat(const Domain &domain
const char static void LogError(const Domain &domain, const char *msg)
Definition: Log.hxx:78
LogLevel
Definition: LogLevel.hxx:31
Debug message for developers.
Unimportant informational message.
Warning: something may be wrong.
int e
Definition: Log.hxx:115
static std::system_error FormatErrno(int code, const char *fmt, Args &&...args)
Definition: Error.hxx:135