libzypp
17.24.2
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
#include <cstring>
15
#include <iosfwd>
16
#include <string>
17
19
#ifdef ZYPP_NDEBUG
20
#define OSDLOG( MSG )
21
#define OSMLOG( L, MSG )
22
#define TRACELEAVE
23
#else
24
namespace
zypp
25
{
26
namespace
debug
27
{
28
void
osdlog
(
const
std::string & msg_r,
unsigned
level_r );
// LogControl.cc
29
30
struct
TraceLeave
// LogControl.cc
31
{
32
TraceLeave
(
const
TraceLeave
& ) =
delete
;
33
TraceLeave
&
operator=
(
const
TraceLeave
& ) =
delete
;
34
TraceLeave
(
const
char
* file_r,
const
char
* fnc_r,
int
line_r );
35
~TraceLeave
();
36
private
:
37
static
unsigned
_depth
;
38
const
char
*
_file
;
39
const
char
*
_fnc
;
40
int
_line
;
41
};
42
}
43
}
44
#define OSDLOG( MSG ) ::zypp::debug::osdlog( MSG, 0 )
45
#define OSMLOG( L, MSG ) ::zypp::debug::osdlog( MSG, L )
46
#define TRACELEAVE ::zypp::debug::TraceLeave _TraceLeave( __FILE__, __FUNCTION__, __LINE__ )
47
#endif // ZYPP_NDEBUG
48
71
72
#ifndef ZYPP_BASE_LOGGER_LOGGROUP
73
74
#define ZYPP_BASE_LOGGER_LOGGROUP "DEFINE_LOGGROUP"
75
#endif
76
77
#define XXX L_XXX( ZYPP_BASE_LOGGER_LOGGROUP )
78
#define DBG L_DBG( ZYPP_BASE_LOGGER_LOGGROUP )
79
#define MIL L_MIL( ZYPP_BASE_LOGGER_LOGGROUP )
80
#define WAR L_WAR( ZYPP_BASE_LOGGER_LOGGROUP )
81
#define ERR L_ERR( ZYPP_BASE_LOGGER_LOGGROUP )
82
#define SEC L_SEC( ZYPP_BASE_LOGGER_LOGGROUP )
83
#define INT L_INT( ZYPP_BASE_LOGGER_LOGGROUP )
84
#define USR L_USR( ZYPP_BASE_LOGGER_LOGGROUP )
85
86
#define L_XXX(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_XXX )
87
#define L_DBG(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP"++", zypp::base::logger::E_MIL )
88
#define L_MIL(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_MIL )
89
#define L_WAR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_WAR )
90
#define L_ERR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_ERR )
91
#define L_SEC(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_SEC )
92
#define L_INT(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_INT )
93
#define L_USR(GROUP) ZYPP_BASE_LOGGER_LOG( GROUP, zypp::base::logger::E_USR )
94
95
#define L_BASEFILE ( *__FILE__ == '/' ? strrchr( __FILE__, '/' ) + 1 : __FILE__ )
96
98
#define ZYPP_BASE_LOGGER_LOG(GROUP,LEVEL) \
99
zypp::base::logger::getStream( GROUP, LEVEL, L_BASEFILE, __FUNCTION__, __LINE__ )
100
103
namespace
zypp
105
{
106
namespace
base
108
{
109
111
namespace
logger
112
{
113
118
enum
LogLevel
{
119
E_XXX
= 999,
120
E_DBG
= 0,
121
E_MIL
,
122
E_WAR
,
123
E_ERR
,
124
E_SEC
,
125
E_INT
,
126
E_USR
127
};
128
139
extern
std::ostream &
getStream
(
const
char
* group_r,
140
LogLevel
level_r,
141
const
char
* file_r,
142
const
char
* func_r,
143
const
int
line_r );
144
extern
bool
isExcessive
();
145
147
}
// namespace logger
149
151
}
// namespace base
154
}
// namespace zypp
156
#endif // ZYPP_BASE_LOGGER_H
zypp::debug::TraceLeave
Definition:
Logger.h:31
zypp::base::logger::E_DBG
@ E_DBG
Debug or verbose.
Definition:
Logger.h:120
zypp::debug::TraceLeave::TraceLeave
TraceLeave(const TraceLeave &)=delete
zypp::debug::TraceLeave::operator=
TraceLeave & operator=(const TraceLeave &)=delete
zypp::base::logger::E_USR
@ E_USR
User log.
Definition:
Logger.h:126
zypp::base::logger::E_WAR
@ E_WAR
Warning.
Definition:
Logger.h:122
zypp::base::logger::getStream
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:425
zypp::debug::TraceLeave::_fnc
const char * _fnc
Definition:
Logger.h:39
zypp::base::logger::E_SEC
@ E_SEC
Secutrity related.
Definition:
Logger.h:124
zypp::base::logger::E_MIL
@ E_MIL
Milestone.
Definition:
Logger.h:121
zypp::base::logger::LogLevel
LogLevel
Definition of log levels.
Definition:
Logger.h:118
zypp::debug::osdlog
void osdlog(const std::string &msg_r, unsigned level_r)
Definition:
LogControl.cc:32
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition:
CodePitfalls.doc:2
zypp::base::logger::E_ERR
@ E_ERR
Error.
Definition:
Logger.h:123
zypp::base::logger::isExcessive
bool isExcessive()
Definition:
LogControl.cc:448
zypp::debug::TraceLeave::_depth
static unsigned _depth
Definition:
Logger.h:37
zypp::debug::TraceLeave::_line
int _line
Definition:
Logger.h:40
zypp::base::logger::E_XXX
@ E_XXX
Excessive logging.
Definition:
Logger.h:119
zypp::debug::TraceLeave::_file
const char * _file
Definition:
Logger.h:38
zypp::debug::TraceLeave::~TraceLeave
~TraceLeave()
Definition:
LogControl.cc:78
zypp::base::logger::E_INT
@ E_INT
Internal error.
Definition:
Logger.h:125
zypp
base
Logger.h
Generated by
1.8.18