27 #if !defined(__CINT__) && !defined(__MAKECINT__)
28 #include "log4cpp/Category.hh"
29 #include "log4cpp/Appender.hh"
30 #include "log4cpp/OstreamAppender.hh"
31 #include "log4cpp/BasicLayout.hh"
32 #include "log4cpp/Priority.hh"
42 #include "Framework/Conventions/GBuild.h"
56 #define pFATAL log4cpp::Priority::FATAL
57 #define pALERT log4cpp::Priority::ALERT
58 #define pCRIT log4cpp::Priority::CRIT
59 #define pERROR log4cpp::Priority::ERROR
60 #define pWARN log4cpp::Priority::WARN
61 #define pNOTICE log4cpp::Priority::NOTICE
62 #define pINFO log4cpp::Priority::INFO
63 #define pDEBUG log4cpp::Priority::DEBUG
67 #ifdef __GENIE_USES_LOG4CPP_VERSION__
68 #if __GENIE_USES_LOG4CPP_VERSION__==0
69 #define ENDL log4cpp::CategoryStream::ENDLINE
71 #define ENDL std::endl
74 #define ENDL std::endl
84 #define SLOG(stream, priority) \
85 (*Messenger::Instance())(stream) \
86 << priority << "[s] <" \
87 << __FUNCTION__ << " (" << __LINE__ << ")> : "
96 #define LOG(stream, priority) \
97 (*Messenger::Instance())(stream) \
98 << priority << "[n] <" \
99 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
110 #ifndef HIDE_GENIE_MSG_LOG_MACROS
112 #define LOG_FATAL(stream) \
113 (*Messenger::Instance())(stream) \
114 << log4cpp::Priority::FATAL << "[n] <" \
115 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
117 #define LOG_ALERT(stream) \
118 (*Messenger::Instance())(stream) \
119 << log4cpp::Priority::ALERT << "[n] <" \
120 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
122 #define LOG_CRIT(stream) \
123 (*Messenger::Instance())(stream) \
124 << log4cpp::Priority::CRIT << "[n] <" \
125 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
127 #define LOG_ERROR(stream) \
128 (*Messenger::Instance())(stream) \
129 << log4cpp::Priority::ERROR << "[n] <" \
130 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
132 #define LOG_WARN(stream) \
133 (*Messenger::Instance())(stream) \
134 << log4cpp::Priority::WARN << "[n] <" \
135 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
137 #define LOG_NOTICE(stream) \
138 (*Messenger::Instance())(stream) \
139 << log4cpp::Priority::NOTICE << "[n] <" \
140 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
142 #define LOG_INFO(stream) \
143 (*Messenger::Instance())(stream) \
144 << log4cpp::Priority::INFO << "[n] <" \
145 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
147 #define LOG_DEBUG(stream) \
148 (*Messenger::Instance())(stream) \
149 << log4cpp::Priority::DEBUG << "[n] <" \
150 << __FILE__ << "::" << __FUNCTION__ << " (" << __LINE__ << ")> : "
152 #endif // HIDE_GENIE_MSG_LOG_MACROS
161 #define LLOG(stream, priority) \
162 (*Messenger::Instance())(stream) \
163 << priority << "[l] <" \
164 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
166 #define LLOG_FATAL(stream) \
167 (*Messenger::Instance())(stream) \
168 << log4cpp::Priority::FATAL << "[l] <" \
169 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
171 #define LLOG_ALERT(stream) \
172 (*Messenger::Instance())(stream) \
173 << log4cpp::Priority::ALERT << "[l] <" \
174 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
176 #define LLOG_CRIT(stream) \
177 (*Messenger::Instance())(stream) \
178 << log4cpp::Priority::CRIT << "[l] <" \
179 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
181 #define LLOG_ERROR(stream) \
182 (*Messenger::Instance())(stream) \
183 << log4cpp::Priority::ERROR << "[l] <" \
184 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
186 #define LLOG_WARN(stream) \
187 (*Messenger::Instance())(stream) \
188 << log4cpp::Priority::WARN << "'[l] <" \
189 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
191 #define LLOG_NOTICE(stream) \
192 (*Messenger::Instance())(stream) \
193 << log4cpp::Priority::NOTICE << "[l] <" \
194 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
196 #define LLOG_INFO(stream) \
197 (*Messenger::Instance())(stream) \
198 << log4cpp::Priority::INFO << "[l] <" \
199 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
201 #define LLOG_DEBUG(stream) \
202 (*Messenger::Instance())(stream) \
203 << log4cpp::Priority::DEBUG << "[l] <" \
204 << __PRETTY_FUNCTION__ << " (" << __LINE__ << ")> : "
212 #define BLOG(stream, priority) \
213 (*Messenger::Instance())(stream) << priority
229 #define TOKCAT(x,y) x##y
231 #define TOKCAT2(x,y) TOKCAT(x,y)
233 #define LINECAT(x) TOKCAT2(x, __LINE__ )
235 #define MAXSLOG(s,l,c) \
236 static int LINECAT(MSGCNT) = 0; \
237 const char* LINECAT(MSGADD) = (++LINECAT(MSGCNT)==c) ? "..Last Message .. " : ""; \
238 if (LINECAT(MSGCNT) > c || LINECAT(MSGCNT) < 0) \
239 {;} else SLOG(s,l) << LINECAT(MSGADD)
241 #define MAXLOG(s,l,c) \
242 static int LINECAT(MSGCNT) = 0; \
243 const char* LINECAT(MSGADD) = (++LINECAT(MSGCNT)==c) ? "..Last Message .. " : ""; \
244 if (LINECAT(MSGCNT) > c || LINECAT(MSGCNT) < 0) \
245 {;} else LOG(s,l) << LINECAT(MSGADD)
247 #define MAXLLOG(s,l,c) \
248 static int LINECAT(MSGCNT) = 0; \
249 const char* LINECAT(MSGADD) = (++LINECAT(MSGCNT)==c) ? "..Last Message .. " : ""; \
250 if (LINECAT(MSGCNT) > c || LINECAT(MSGCNT) < 0) \
251 {;} else LLOG(s,l) << LINECAT(MSGADD)
263 log4cpp::Category &
operator () (
const char * stream);
292 #endif // _MESSENGER_H_
void DummyMethodAndSilentCompiler()
log4cpp::Priority::Value PriorityFromString(string priority)
log4cpp::Category & operator()(const char *stream)
bool SetPrioritiesFromXmlFile(string filename)
static Messenger * Instance(void)
A more convenient interface to the log4cpp Message Service.
void SetPriorityLevel(const char *stream, log4cpp::Priority::Value p)
static Messenger * fInstance