log4cplus 2.0.8
loglevel.h
Go to the documentation of this file.
1// -*- C++ -*-
2// Module: Log4CPLUS
3// File: loglevel.h
4// Created: 6/2001
5// Author: Tad E. Smith
6//
7//
8// Copyright 2001-2017 Tad E. Smith
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21
26#ifndef LOG4CPLUS_LOGLEVEL_HEADER_
27#define LOG4CPLUS_LOGLEVEL_HEADER_
28
29#include <log4cplus/config.hxx>
30
31#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
32#pragma once
33#endif
34
35#include <vector>
36#include <log4cplus/tstring.h>
37
38
39namespace log4cplus {
40
48 typedef int LogLevel;
49
53 const LogLevel OFF_LOG_LEVEL = 60000;
54
59
64
68 const LogLevel WARN_LOG_LEVEL = 30000;
69
74 const LogLevel INFO_LOG_LEVEL = 20000;
75
80
85
90
96
97
104 typedef log4cplus::tstring const & (*LogLevelToStringMethod)(LogLevel);
105
106
114
115
116
131 public:
134
143
152
160 void pushToStringMethod(LogLevelToStringMethod newToString);
161
169 void pushFromStringMethod(StringToLogLevelMethod newFromString);
170
171 private:
172 // Data
173 struct LogLevelToStringMethodRec
174 {
175 LogLevelToStringMethodRec ();
176 LogLevelToStringMethodRec (LogLevelToStringMethod);
177
179 };
180
181 typedef std::vector<LogLevelToStringMethodRec> LogLevelToStringMethodList;
182 LogLevelToStringMethodList toStringMethods;
183
184 typedef std::vector<StringToLogLevelMethod> StringToLogLevelMethodList;
185 StringToLogLevelMethodList fromStringMethods;
186
187 // Disable Copy
189 LogLevelManager& operator=(const LogLevelManager&);
190 };
191
196
197}
198
199
200#endif // LOG4CPLUS_LOGLEVEL_HEADER_
This class is used to "manage" LogLevel definitions.
Definition loglevel.h:130
void pushFromStringMethod(StringToLogLevelMethod newFromString)
When creating a "derived" LogLevel, a StringToLogLevelMethod should be defined and registered with th...
log4cplus::tstring const & toString(LogLevel ll) const
This method is called by all Layout classes to convert a LogLevel into a string.
void pushToStringMethod(LogLevelToStringMethod newToString)
When creating a "derived" LogLevel, a LogLevelToStringMethod should be defined and registered with th...
LogLevel fromString(const log4cplus::tstring &arg) const
This method is called by all classes internally to log4cplus to convert a string into a LogLevel.
const LogLevel WARN_LOG_LEVEL
The WARN_LOG_LEVEL LogLevel designates potentially harmful situations.
Definition loglevel.h:68
std::basic_string< tchar > tstring
Definition tstring.h:39
const LogLevel INFO_LOG_LEVEL
The INFO_LOG_LEVEL LogLevel designates informational messages that highlight the progress of the appl...
Definition loglevel.h:74
const LogLevel ERROR_LOG_LEVEL
The ERROR_LOG_LEVEL LogLevel designates error events that might still allow the application to contin...
Definition loglevel.h:63
const LogLevel TRACE_LOG_LEVEL
The TRACE_LOG_LEVEL LogLevel is used to "trace" entry and exiting of methods.
Definition loglevel.h:84
const LogLevel NOT_SET_LOG_LEVEL
The NOT_SET_LOG_LEVEL LogLevel is used to indicated that no particular LogLevel is desired and that t...
Definition loglevel.h:95
const LogLevel FATAL_LOG_LEVEL
The FATAL_LOG_LEVEL LogLevel designates very severe error events that will presumably lead the applic...
Definition loglevel.h:58
LogLevel(* StringToLogLevelMethod)(const log4cplus::tstring &)
This method type defined the signature of methods that convert strings into LogLevels.
Definition loglevel.h:113
log4cplus::tstring const &(* LogLevelToStringMethod)(LogLevel)
This method type defined the signature of methods that convert LogLevels into strings.
Definition loglevel.h:104
const LogLevel DEBUG_LOG_LEVEL
The DEBUG_LOG_LEVEL LogLevel designates fine-grained informational events that are most useful to deb...
Definition loglevel.h:79
const LogLevel OFF_LOG_LEVEL
The OFF_LOG_LEVEL LogLevel is used during configuration to turn off logging.
Definition loglevel.h:53
int LogLevel
Defines the minimum set of priorities recognized by the system, that is FATAL_LOG_LEVEL,...
Definition loglevel.h:48
LOG4CPLUS_EXPORT LogLevelManager & getLogLevelManager()
Returns the singleton LogLevelManager.
const LogLevel ALL_LOG_LEVEL
The ALL_LOG_LEVEL LogLevel is used during configuration to turn on all logging.
Definition loglevel.h:89
#define LOG4CPLUS_EXPORT
Definition win32.h:141