yast2-core
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
liby2util-r
src
include
y2util
Y2SLog.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| |
3
| __ __ ____ _____ ____ |
4
| \ \ / /_ _/ ___|_ _|___ \ |
5
| \ V / _` \___ \ | | __) | |
6
| | | (_| |___) || | / __/ |
7
| |_|\__,_|____/ |_| |_____| |
8
| |
9
| core system |
10
| (C) SuSE GmbH |
11
\----------------------------------------------------------------------/
12
13
File: Y2SLog.h
14
15
Author: Michael Andres <ma@suse.de>
16
Maintainer: Michael Andres <ma@suse.de>
17
18
/-*/
19
#ifndef Y2SLog_h
20
#define Y2SLog_h
21
22
#include <iostream>
23
24
// Don't know why y2log.h insists on having a component name
25
// defined and throws an error if it's missing.
26
// However, I want Y2SLog to work out of the box.
27
#ifndef Y2LOG
28
#define Y2LOG "DEFINE_Y2LOG"
29
#endif
30
31
#include <
y2util/y2log.h
>
32
34
//
35
namespace
Y2SLog
{
36
//
38
39
extern
bool
dbg_enabled_bm
;
40
41
extern
std::ostream &
get
(
const
char
* which,
const
unsigned
level,
42
const
char
* fil,
const
char
* fnc,
const
int
lne );
43
44
extern
std::ostream &
getdbg
(
const
char
* which,
const
unsigned
level,
45
const
char
* fil,
const
char
* fnc,
const
int
lne );
46
47
}
// namespace Y2SLog
49
50
#define _Y2SLOG(c,l) Y2SLog::get( c, l, __FILE__, __FUNCTION__, __LINE__ )
51
#define _Y2SLOD(c,l) Y2SLog::get( c"++", 1, __FILE__, __FUNCTION__, __LINE__ )
52
#define _Y2SLOGDBG(c,l) Y2SLog::getdbg( c"-dbg", l, __FILE__, __FUNCTION__, __LINE__ )
53
#define _Y2SLODDBG(c,l) Y2SLog::getdbg( c"-dbg++", 1, __FILE__, __FUNCTION__, __LINE__ )
54
55
//
56
// To log to component 'foo' write:
57
//
58
// _DBG("foo") << ....
59
// or
60
// #define Y2LOG "foo"
61
// DBG << ....
62
//
63
64
#define _DBG(c) _Y2SLOD( c, 0 )
65
#define _MIL(c) _Y2SLOG( c, 1 )
66
#define _WAR(c) _Y2SLOG( c, 2 )
67
#define _ERR(c) _Y2SLOG( c, 3 )
68
#define _SEC(c) _Y2SLOG( c, 4 )
69
#define _INT(c) _Y2SLOG( c, 5 )
70
71
#define DBG _DBG(Y2LOG)
72
#define MIL _MIL(Y2LOG)
73
#define WAR _WAR(Y2LOG)
74
#define ERR _ERR(Y2LOG)
75
#define SEC _SEC(Y2LOG)
76
#define INT _INT(Y2LOG)
77
78
//
79
// To enable debug output (using component 'foo-dbg'), set 'Y2SLog::dbg_enabled_bm = true;'.
80
// Unless the environmental variable Y2SLOG_DEBUG is defined (with arbitrary value),
81
// debug output is disabled by default.
82
//
83
// _D__("foo") << ....
84
//
85
// #define Y2LOG "foo"
86
// D__ << ....
87
//
88
#define _D__(c) _Y2SLODDBG( c, 0 )
89
#define _M__(c) _Y2SLOGDBG( c, 1 )
90
#define _W__(c) _Y2SLOGDBG( c, 2 )
91
#define _E__(c) _Y2SLOGDBG( c, 3 )
92
#define _S__(c) _Y2SLOGDBG( c, 4 )
93
#define _I__(c) _Y2SLOGDBG( c, 5 )
94
95
#define D__ _D__(Y2LOG)
96
#define M__ _M__(Y2LOG)
97
#define W__ _W__(Y2LOG)
98
#define E__ _E__(Y2LOG)
99
#define S__ _S__(Y2LOG)
100
#define I__ _I__(Y2LOG)
101
103
104
#endif // Y2SLog_h
Y2SLog
Definition:
Y2SLog.h:35
Y2SLog::dbg_enabled_bm
bool dbg_enabled_bm
y2log.h
Y2SLog::getdbg
std::ostream & getdbg(const char *which, const unsigned level, const char *fil, const char *fnc, const int lne)
Definition:
Y2SLog.cc:241
Generated on a sunny day for yast2-core by
1.8.8