loglevel.h
Go to the documentation of this file.
// -*- C++ -*-
// Module: Log4CPLUS
// File: loglevel.h
// Created: 6/2001
// Author: Tad E. Smith
//
//
// Copyright 2001-2017 Tad E. Smith
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef LOG4CPLUS_LOGLEVEL_HEADER_
#define LOG4CPLUS_LOGLEVEL_HEADER_
#include <log4cplus/config.hxx>
#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
#pragma once
#endif
#include <vector>
#include <log4cplus/tstring.h>
namespace log4cplus {
typedef int LogLevel;
const LogLevel OFF_LOG_LEVEL = 60000;
const LogLevel FATAL_LOG_LEVEL = 50000;
const LogLevel ERROR_LOG_LEVEL = 40000;
const LogLevel WARN_LOG_LEVEL = 30000;
const LogLevel INFO_LOG_LEVEL = 20000;
const LogLevel DEBUG_LOG_LEVEL = 10000;
const LogLevel TRACE_LOG_LEVEL = 0;
const LogLevel ALL_LOG_LEVEL = TRACE_LOG_LEVEL;
const LogLevel NOT_SET_LOG_LEVEL = -1;
typedef log4cplus::tstring const & (*LogLevelToStringMethod)(LogLevel);
typedef LogLevel (*StringToLogLevelMethod)(const log4cplus::tstring&);
class LOG4CPLUS_EXPORT LogLevelManager {
public:
LogLevelManager();
~LogLevelManager();
log4cplus::tstring const & toString(LogLevel ll) const;
LogLevel fromString(const log4cplus::tstring& arg) const;
void pushToStringMethod(LogLevelToStringMethod newToString);
void pushFromStringMethod(StringToLogLevelMethod newFromString);
private:
// Data
struct LogLevelToStringMethodRec
{
LogLevelToStringMethodRec ();
LogLevelToStringMethodRec (LogLevelToStringMethod);
LogLevelToStringMethod func;
};
typedef std::vector<LogLevelToStringMethodRec> LogLevelToStringMethodList;
LogLevelToStringMethodList toStringMethods;
typedef std::vector<StringToLogLevelMethod> StringToLogLevelMethodList;
StringToLogLevelMethodList fromStringMethods;
// Disable Copy
LogLevelManager(const LogLevelManager&);
LogLevelManager& operator=(const LogLevelManager&);
};
LOG4CPLUS_EXPORT LogLevelManager& getLogLevelManager();
}
#endif // LOG4CPLUS_LOGLEVEL_HEADER_
log4cplus::LogLevelManager
This class is used to "manage" LogLevel definitions.
Definition loglevel.h:130
log4cplus::LogLevelManager::pushFromStringMethod
void pushFromStringMethod(StringToLogLevelMethod newFromString)
When creating a "derived" LogLevel, a StringToLogLevelMethod should be defined and registered with th...
log4cplus::LogLevelManager::toString
log4cplus::tstring const & toString(LogLevel ll) const
This method is called by all Layout classes to convert a LogLevel into a string.
log4cplus::LogLevelManager::pushToStringMethod
void pushToStringMethod(LogLevelToStringMethod newToString)
When creating a "derived" LogLevel, a LogLevelToStringMethod should be defined and registered with th...
log4cplus::LogLevelManager::~LogLevelManager
~LogLevelManager()
log4cplus::LogLevelManager::LogLevelManager
LogLevelManager()
log4cplus::LogLevelManager::fromString
LogLevel fromString(const log4cplus::tstring &arg) const
This method is called by all classes internally to log4cplus to convert a string into a LogLevel.
config.hxx
log4cplus
Definition appender.h:46
log4cplus::WARN_LOG_LEVEL
const LogLevel WARN_LOG_LEVEL
The WARN_LOG_LEVEL LogLevel designates potentially harmful situations.
Definition loglevel.h:68
log4cplus::tstring
std::basic_string< tchar > tstring
Definition tstring.h:39
log4cplus::INFO_LOG_LEVEL
const LogLevel INFO_LOG_LEVEL
The INFO_LOG_LEVEL LogLevel designates informational messages that highlight the progress of the appl...
Definition loglevel.h:74
log4cplus::ERROR_LOG_LEVEL
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
log4cplus::TRACE_LOG_LEVEL
const LogLevel TRACE_LOG_LEVEL
The TRACE_LOG_LEVEL LogLevel is used to "trace" entry and exiting of methods.
Definition loglevel.h:84
log4cplus::NOT_SET_LOG_LEVEL
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
log4cplus::FATAL_LOG_LEVEL
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
log4cplus::StringToLogLevelMethod
LogLevel(* StringToLogLevelMethod)(const log4cplus::tstring &)
This method type defined the signature of methods that convert strings into LogLevels.
Definition loglevel.h:113
log4cplus::LogLevelToStringMethod
log4cplus::tstring const &(* LogLevelToStringMethod)(LogLevel)
This method type defined the signature of methods that convert LogLevels into strings.
Definition loglevel.h:104
log4cplus::DEBUG_LOG_LEVEL
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
log4cplus::OFF_LOG_LEVEL
const LogLevel OFF_LOG_LEVEL
The OFF_LOG_LEVEL LogLevel is used during configuration to turn off logging.
Definition loglevel.h:53
log4cplus::getLogLevelManager
LOG4CPLUS_EXPORT LogLevelManager & getLogLevelManager()
Returns the singleton LogLevelManager.
log4cplus::ALL_LOG_LEVEL
const LogLevel ALL_LOG_LEVEL
The ALL_LOG_LEVEL LogLevel is used during configuration to turn on all logging.
Definition loglevel.h:89
log4cplus::LogLevel
int LogLevel
Defines the minimum set of priorities recognized by the system, that is FATAL_LOG_LEVEL,...
Definition loglevel.h:48
tstring.h
LOG4CPLUS_EXPORT
#define LOG4CPLUS_EXPORT
Definition win32.h:141