log4tango
4.0.7
Main Page
Namespaces
Classes
Files
File List
File Members
lib
cpp
log4tango
include
log4tango
Appender.hh
Go to the documentation of this file.
1
//
2
// Appender.hh
3
//
4
// Copyright (C) : 2000 - 2002
5
// LifeLine Networks BV (www.lifeline.nl). All rights reserved.
6
// Bastiaan Bakker. All rights reserved.
7
//
8
// 2004,2005,2006,2007,2008,2009,2010,2011,2012
9
// Synchrotron SOLEIL
10
// L'Orme des Merisiers
11
// Saint-Aubin - BP 48 - France
12
//
13
// This file is part of log4tango.
14
//
15
// Log4ango is free software: you can redistribute it and/or modify
16
// it under the terms of the GNU Lesser General Public License as published by
17
// the Free Software Foundation, either version 3 of the License, or
18
// (at your option) any later version.
19
//
20
// Log4tango is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied warranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
// GNU Lesser General Public License for more details.
24
//
25
// You should have received a copy of the GNU Lesser General Public License
26
// along with Log4Tango. If not, see <http://www.gnu.org/licenses/>.
27
28
#include <
log4tango/Portability.hh
>
29
#include <string>
30
#include <map>
31
#include <set>
32
#include <
log4tango/Level.hh
>
33
#include <
log4tango/Layout.hh
>
34
#include <
log4tango/LoggingEvent.hh
>
35
#include <
log4tango/threading/Threading.hh
>
36
37
#ifndef _LOG4TANGO_APPENDER_H
38
#define _LOG4TANGO_APPENDER_H
39
40
namespace
log4tango {
41
42
//-----------------------------------------------------------------------------
43
// class : Appender
44
//-----------------------------------------------------------------------------
45
class
LOG4TANGO_EXPORT
Appender
46
{
47
friend
class
Logger
;
48
49
protected
:
55
Appender
(
const
std::string& name);
56
63
virtual
void
level_changed (
Level::Value
new_level);
64
65
public
:
69
virtual
~
Appender
();
70
75
#if defined(APPENDERS_HAVE_LEVEL_THRESHOLD) || defined(APPENDERS_HAVE_FILTERS)
76
int
append (
const
LoggingEvent
& event);
77
#else
78
inline
int
append
(
const
LoggingEvent
& event) {
79
return
_append(event);
80
}
81
#endif
82
88
virtual
bool
reopen (
void
);
89
94
virtual
void
close (
void
) = 0;
95
101
virtual
bool
requires_layout (
void
)
const
= 0;
102
106
virtual
void
set_layout (
Layout
* layout = 0) = 0;
107
111
inline
const
std::string&
get_name
(
void
)
const
{
112
return
_name;
113
}
114
122
virtual
bool
is_valid (
void
)
const
;
123
124
#ifdef APPENDERS_HAVE_LEVEL_THRESHOLD
125
131
void
set_level (
Level::Value
level);
132
137
Level::Value
get_level (
void
)
const
;
138
#endif // APPENDERS_HAVE_LEVEL_THRESHOLD
139
140
#ifdef APPENDERS_HAVE_FILTERS
141
144
virtual
void
set_filter (Filter* filter);
145
150
virtual
Filter* get_filter (
void
);
151
#endif // APPENDERS_HAVE_FILTERS
152
153
protected
:
159
virtual
int
_append(
const
LoggingEvent
& event) = 0;
160
161
private
:
165
const
std::string _name;
166
167
#ifdef APPENDERS_HAVE_LEVEL_THRESHOLD
168
171
Level::Value
_level;
172
#endif
173
174
#ifdef APPENDERS_HAVE_FILTERS
175
178
Filter* _filter;
179
#endif
180
};
181
182
}
// namespace log4tango
183
184
#endif // _LOG4TANGO_APPENDER_H
Generated on Thu Nov 14 2013 18:35:17 for log4tango by
1.8.4