Kea 2.5.8
logger_manager.h
Go to the documentation of this file.
1// Copyright (C) 2011-2019 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef LOGGER_MANAGER_H
8#define LOGGER_MANAGER_H
9
12
13#include <boost/noncopyable.hpp>
14
15#include <mutex>
16
17// Generated if, when updating the logging specification, an unknown
18// destination is encountered.
20public:
21 UnknownLoggingDestination(const char* file, size_t line, const char* what) :
22 isc::Exception(file, line, what)
23 {}
24};
25
26namespace isc {
27namespace log {
28
29class LoggerManagerImpl;
30
38
39class LoggerManager : public boost::noncopyable {
40public:
43
46
55 template <typename T>
56 void process(T start, T finish) {
57 processInit();
58 for (T i = start; i != finish; ++i) {
59 processSpecification(*i);
60 }
61 processEnd();
62 }
63
69 void process(const LoggerSpecification& spec) {
70 processInit();
71 processSpecification(spec);
72 processEnd();
73 }
74
85 void process() {
86 processInit();
87 processEnd();
88 }
89
111 static void init(const std::string& root,
113 int dbglevel = 0, const char* file = NULL,
114 bool buffer = false);
115
122 static void logDuplicatedMessages();
123
128 static void reset();
129
137 static void readLocalMessageFile(const char* file);
138
142 static std::mutex& getMutex();
143
144private:
151 void processInit();
152
157 void processSpecification(const LoggerSpecification& spec);
158
163 void processEnd();
164
165 // Members
166 LoggerManagerImpl* impl_;
167};
168
169} // namespace log
170} // namespace isc
171
172
173#endif // LOGGER_MANAGER_H
UnknownLoggingDestination(const char *file, size_t line, const char *what)
This is a base class for exceptions thrown from the DNS library module.
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Logger Manager Implementation.
static void init(const std::string &root, isc::log::Severity severity=isc::log::INFO, int dbglevel=0, const char *file=NULL, bool buffer=false)
Run-Time Initialization.
static void reset()
Reset logging.
static void logDuplicatedMessages()
List duplicated log messages.
void process(const LoggerSpecification &spec)
Process a single specification.
void process()
Process 'empty' specification.
void process(T start, T finish)
Process Specifications.
static std::mutex & getMutex()
Return a process-global mutex that's used for mutual exclusion among threads of a single process duri...
static void readLocalMessageFile(const char *file)
Read local message file.
LoggerManager()
Constructor.
Severity
Severity Levels.
Definition: logger_level.h:23
Defines the logger used by the top-level component of kea-lfc.