libzypp  13.10.6
Logger.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_BASE_LOGGER_H
13 #define ZYPP_BASE_LOGGER_H
14 
15 #include <iosfwd>
16 #include <cstring>
17 
39 
40 #ifndef ZYPP_BASE_LOGGER_LOGGROUP
41 
42 #define ZYPP_BASE_LOGGER_LOGGROUP "DEFINE_LOGGROUP"
43 #endif
44 
45 #define XXX _XXX( ZYPP_BASE_LOGGER_LOGGROUP )
46 #define DBG _DBG( ZYPP_BASE_LOGGER_LOGGROUP )
47 #define MIL _MIL( ZYPP_BASE_LOGGER_LOGGROUP )
48 #define WAR _WAR( ZYPP_BASE_LOGGER_LOGGROUP )
49 #define ERR _ERR( ZYPP_BASE_LOGGER_LOGGROUP )
50 #define SEC _SEC( ZYPP_BASE_LOGGER_LOGGROUP )
51 #define INT _INT( ZYPP_BASE_LOGGER_LOGGROUP )
52 #define USR _USR( ZYPP_BASE_LOGGER_LOGGROUP )
53 
54 #define _XXX(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_XXX )
55 #define _DBG(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP"++", zypp::base::logger::E_MIL )
56 #define _MIL(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_MIL )
57 #define _WAR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_WAR )
58 #define _ERR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_ERR )
59 #define _SEC(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_SEC )
60 #define _INT(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_INT )
61 #define _USR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_USR )
62 
63 #define _BASEFILE ( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )
64 
66 #define ZYPP_BASE_LOGGER_LOG(GROUP,LEVEL) \
67  zypp::base::logger::getStream( GROUP, LEVEL, _BASEFILE, __FUNCTION__, __LINE__ )
68 
71 namespace zypp
73 {
74  namespace base
76  {
77 
79  namespace logger
80  {
81 
86  enum LogLevel {
87  E_XXX = 999,
88  E_DBG = 0,
95  };
96 
107  extern std::ostream & getStream( const char * group_r,
108  LogLevel level_r,
109  const char * file_r,
110  const char * func_r,
111  const int line_r );
112  extern bool isExcessive();
113 
115  } // namespace logger
117 
119  } // namespace base
122 } // namespace zypp
124 #endif // ZYPP_BASE_LOGGER_H
Internal error.
Definition: Logger.h:93
LogLevel
Definition of log levels.
Definition: Logger.h:86
Debug or verbose.
Definition: Logger.h:88
Secutrity related.
Definition: Logger.h:92
Excessive logging.
Definition: Logger.h:87
std::ostream & getStream(const char *group_r, LogLevel level_r, const char *file_r, const char *func_r, const int line_r)
Return a log stream to write on.
Definition: LogControl.cc:365