Kea  2.1.7-git
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 
26 namespace isc {
27 namespace log {
28 
30 public:
31  typedef std::vector<OutputOption>::iterator iterator;
32  typedef std::vector<OutputOption>::const_iterator const_iterator;
33 
41  LoggerSpecification(const std::string& name = "",
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 
64  severity_ = severity;
65  }
66 
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 
137 private:
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
void addOutputOption(const OutputOption &option)
Add output option.
void setName(const std::string &name)
Set the name of the logger.
std::vector< OutputOption >::iterator iterator
LoggerSpecification(const std::string &name="", isc::log::Severity severity=isc::log::INFO, int dbglevel=0, bool additive=false)
Constructor.
Severity
Severity Levels.
Definition: logger_level.h:23
Defines the logger used by the top-level component of kea-lfc.
isc::log::Severity getSeverity() const
std::vector< OutputOption >::const_iterator const_iterator
void setDbglevel(int dbglevel)
Set the debug level.
void setSeverity(isc::log::Severity severity)
Set the severity.
void reset()
Reset back to defaults.
void setAdditive(bool additive)
Set the additive flag.