Kea  2.3.5-git
logger_manager_impl.h
Go to the documentation of this file.
1 // Copyright (C) 2011-2022 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_IMPL_H
8 #define LOGGER_MANAGER_IMPL_H
9 
10 #include <string>
11 
12 #include <log4cplus/appender.h>
13 #include <log/logger_level.h>
15 
16 // Forward declaration to avoid need to include log4cplus header file here.
17 namespace log4cplus {
18 class Logger;
19 class Appender;
20 }
21 
22 namespace isc {
23 namespace log {
24 
25 // Forward declarations
26 struct OutputOption;
27 
41 
43 public:
44 
47 
53  void processInit();
54 
60  void processSpecification(const LoggerSpecification& spec);
61 
65  void processEnd();
66 
83  static void init(isc::log::Severity severity = isc::log::INFO,
84  int dbglevel = 0, bool buffer = false);
85 
93  static void reset(isc::log::Severity severity = isc::log::INFO,
94  int dbglevel = 0);
95 
96 private:
104  static void appenderFactory(log4cplus::Logger& logger,
105  LoggerSpecification const& spec);
106 
114  static void createConsoleAppender(log4cplus::Logger& logger,
115  const OutputOption& opt);
116 
125  static void createFileAppender(log4cplus::Logger& logger,
126  const OutputOption& opt);
127 
135  static void createSyslogAppender(log4cplus::Logger& logger,
136  const OutputOption& opt);
137 
145  static void createBufferAppender(log4cplus::Logger& logger);
146 
157  static void initRootLogger(isc::log::Severity severity = isc::log::INFO,
158  int dbglevel = 0, bool buffer = false);
159 
167  static void setAppenderLayout(log4cplus::SharedAppenderPtr& appender,
168  std::string pattern);
169 
176  void storeBufferAppenders();
177 
182  void flushBufferAppenders();
183 
187  std::vector<log4cplus::SharedAppenderPtr> buffer_appender_store_;
188 
191  LoggerSpecification root_spec_;
192 };
193 
194 } // namespace log
195 } // namespace isc
196 
197 #endif // LOGGER_MANAGER_IMPL_H
Logger Manager Implementation.
Severity
Severity Levels.
Definition: logger_level.h:23
Defines the logger used by the top-level component of kea-lfc.
isc::log::Logger logger("asiodns")
Use the ASIO logger.