EUDAQ
 All Classes Namespaces Files Functions Variables Pages
Logger.hh
1 #ifndef EUDAQ_INCLUDED_Logger
2 #define EUDAQ_INCLUDED_Logger
3 
4 #include "eudaq/LogSender.hh"
5 #include "eudaq/LogMessage.hh"
6 #include "eudaq/Platform.hh"
7 
8 namespace eudaq {
9  DLLEXPORT LogSender &GetLogger();
10 }
11 
12 #define EUDAQ_LOG_LEVEL(level) ::eudaq::GetLogger().SetLevel(level)
13 #define EUDAQ_ERR_LEVEL(level) ::eudaq::GetLogger().SetErrLevel(level)
14 #define EUDAQ_IS_LOGGED(level) ::eudaq::GetLogger().IsLogged(level)
15 #define EUDAQ_LOG_CONNECT(type, name, server) \
16  ::eudaq::GetLogger().Connect(type, name, server)
17 
18 #define EUDAQ_LOG(level, msg) \
19  ::eudaq::GetLogger().SendLogMessage( \
20  ::eudaq::LogMessage(msg, ::eudaq::LogMessage::LVL_##level) \
21  .SetLocation(__FILE__, __LINE__, EUDAQ_FUNC))
22 
23 #define EUDAQ_DEBUG(msg) EUDAQ_LOG(DEBUG, msg)
24 #define EUDAQ_EXTRA(msg) EUDAQ_LOG(EXTRA, msg)
25 #define EUDAQ_INFO(msg) EUDAQ_LOG(INFO, msg)
26 #define EUDAQ_WARN(msg) EUDAQ_LOG(WARN, msg)
27 #define EUDAQ_ERROR(msg) EUDAQ_LOG(ERROR, msg)
28 #define EUDAQ_USER(msg) EUDAQ_LOG(USER, msg)
29 
30 #define EUDAQ_LOG_STREAMOUT(level, msg, outStream, error_stream) \
31  ::eudaq::GetLogger().SendLogMessage( \
32  ::eudaq::LogMessage(msg, ::eudaq::LogMessage::LVL_##level) \
33  .SetLocation(__FILE__, __LINE__, EUDAQ_FUNC), \
34  outStream, error_stream)
35 #define EUDAQ_DEBUG_STREAMOUT(msg, outStream, error_stream) \
36  EUDAQ_LOG_STREAMOUT(DEBUG, msg, outStream, error_stream)
37 #define EUDAQ_EXTRA_STREAMOUT(msg, outStream, error_stream) \
38  EUDAQ_LOG_STREAMOUT(EXTRA, msg, outStream, error_stream)
39 #define EUDAQ_INFO_STREAMOUT(msg, outStream, error_stream) \
40  EUDAQ_LOG_STREAMOUT(INFO, msg, outStream, error_stream)
41 #define EUDAQ_WARN_STREAMOUT(msg, outStream, error_stream) \
42  EUDAQ_LOG_STREAMOUT(WARN, msg, outStream, error_stream)
43 #define EUDAQ_ERROR_STREAMOUT(msg, outStream, error_stream) \
44  EUDAQ_LOG_STREAMOUT(ERROR, msg, outStream, error_stream)
45 #define EUDAQ_USER_STREAMOUT(msg, outStream, error_stream) \
46  EUDAQ_LOG_STREAMOUT(USER, msg, outStream, error_stream)
47 
48 // #define EUDAQ_DEBUG(msg, outStream) EUDAQ_DEBUG(DEBUG, msg, outStream,
49 // outStream)
50 // #define EUDAQ_EXTRA(msg, outStream) EUDAQ_EXTRA(EXTRA, msg, outStream,
51 // outStream)
52 // #define EUDAQ_INFO( msg, outStream) EUDAQ_INFO( INFO, msg, outStream,
53 // outStream)
54 // #define EUDAQ_WARN( msg, outStream) EUDAQ_WARN( WARN, msg, outStream,
55 // outStream)
56 // #define EUDAQ_ERROR(msg, outStream) EUDAQ_ERROR(ERROR, msg, outStream,
57 // outStream)
58 // #define EUDAQ_USER( msg, outStream) EUDAQ_USER( USER, msg, outStream,
59 // outStream)
60 
61 #endif // EUDAQ_INCLUDED_Logger