Kea: logger_specification.h Source File

| Kea 3.0.0

logger_specification.h
Go to the documentation of this file.
1// Copyright (C) 2011-2015 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_SPECIFICATION_H
8#define LOGGER_SPECIFICATION_H
9
10#include <stdint.h>
11#include <stdlib.h>
12
13#include <log/logger_level.h>
14#include <log/output_option.h>
15
23
24#include <vector>
25
26namespace isc {
27namespace log {
28
29 class LoggerSpecification {
30public:
31 typedef std::vector<OutputOption>::iterator iterator;
32 typedef std::vector<OutputOption>::const_iterator const_iterator;
33
41 LoggerSpecification(const std::string& name = "",
42 isc::log::Severity severity = isc::log::INFO,
43 int dbglevel = 0, bool additive = false) :
44 name_(name), severity_(severity), dbglevel_(dbglevel),
45 additive_(additive)
46 {}
47
51 void setName(const std::string& name) {
52 name_ = name;
53 }
54
56 std::string getName() const {
57 return name_;
58 }
59
63 void setSeverity(isc::log::Severity severity) {
64 severity_ = severity;
65 }
66
68 isc::log::Severity getSeverity() const {
69 return severity_;
70 }
71
75 void setDbglevel(int dbglevel) {
76 dbglevel_ = dbglevel;
77 }
78
80 int getDbglevel() const {
81 return dbglevel_;
82 }
83
87 void setAdditive(bool additive) {
88 additive_ = additive;
89 }
90
92 bool getAdditive() const {
93 return additive_;
94 }
95
99 void addOutputOption(const OutputOption& option) {
100 options_.push_back(option);
101 }
102
104 iterator begin() {
105 return options_.begin();
106 }
107
109 const_iterator begin() const {
110 return options_.begin();
111 }
112
114 iterator end() {
115 return options_.end();
116 }
117
119 const_iterator end() const {
120 return options_.end();
121 }
122
124 size_t optionCount() const {
125 return options_.size();
126 }
127
129 void reset() {
130 name_ = "";
131 severity_ = isc::log::INFO;
132 dbglevel_ = 0;
133 additive_ = false;
134 options_.clear();
135 }
136
137private:
138 std::string name_;
139 isc::log::Severity severity_;
140 int dbglevel_;
141 bool additive_;
142 std::vector<OutputOption> options_;
143};
144
145} // namespace log
146} // namespace isc
147
148#endif // LOGGER_SPECIFICATION_H
isc::log::LoggerSpecification::getSeverity
isc::log::Severity getSeverity() const
Definition logger_specification.h:68
isc::log::LoggerSpecification::addOutputOption
void addOutputOption(const OutputOption &option)
Add output option.
Definition logger_specification.h:99
isc::log::LoggerSpecification::LoggerSpecification
LoggerSpecification(const std::string &name="", isc::log::Severity severity=isc::log::INFO, int dbglevel=0, bool additive=false)
Constructor.
Definition logger_specification.h:41
isc::log::LoggerSpecification::getName
std::string getName() const
Definition logger_specification.h:56
isc::log::LoggerSpecification::getDbglevel
int getDbglevel() const
Definition logger_specification.h:80
isc::log::LoggerSpecification::iterator
std::vector< OutputOption >::iterator iterator
Definition logger_specification.h:31
isc::log::LoggerSpecification::end
const_iterator end() const
Definition logger_specification.h:119
isc::log::LoggerSpecification::const_iterator
std::vector< OutputOption >::const_iterator const_iterator
Definition logger_specification.h:32
isc::log::LoggerSpecification::setDbglevel
void setDbglevel(int dbglevel)
Set the debug level.
Definition logger_specification.h:75
isc::log::LoggerSpecification::end
iterator end()
Definition logger_specification.h:114
isc::log::LoggerSpecification::setSeverity
void setSeverity(isc::log::Severity severity)
Set the severity.
Definition logger_specification.h:63
isc::log::LoggerSpecification::begin
const_iterator begin() const
Definition logger_specification.h:109
isc::log::LoggerSpecification::optionCount
size_t optionCount() const
Definition logger_specification.h:124
isc::log::LoggerSpecification::reset
void reset()
Reset back to defaults.
Definition logger_specification.h:129
isc::log::LoggerSpecification::begin
iterator begin()
Definition logger_specification.h:104
isc::log::LoggerSpecification::setName
void setName(const std::string &name)
Set the name of the logger.
Definition logger_specification.h:51
isc::log::LoggerSpecification::setAdditive
void setAdditive(bool additive)
Set the additive flag.
Definition logger_specification.h:87
isc::log::LoggerSpecification::getAdditive
bool getAdditive() const
Definition logger_specification.h:92
logger_level.h
isc::log
Definition buffer_appender_impl.cc:17
isc::log::Severity
Severity
Severity Levels.
Definition logger_level.h:23
isc::log::INFO
@ INFO
Definition logger_level.h:26
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
output_option.h
isc::log::OutputOption
Definition output_option.h:37