1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef LOGGER_SPECIFICATION_H
#define LOGGER_SPECIFICATION_H

#include <stdint.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <stdlib.h><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <log/logger_level.h>
#include <log/output_option.h>

/// \brief Logger Specification
///
/// The logging configuration options are a list of logger specifications, each
/// of which represents a logger and the options for its appenders.
///
/// Unlike OutputOption (which is a struct), this contains a bit more
/// structure and is concealed in a class.

#include <vector><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace isc {
namespace log {

class LoggerSpecification {
public:
    typedef std::vector<OutputOption>::iterator         iterator;
    typedef std::vector<OutputOption>::const_iterator   const_iterator;

    /// \brief Constructor
    ///
    /// \param name Name of the logger.
    /// \param severity Severity at which this logger logs
    /// \param dbglevel Debug level
    /// \param additive true to cause message logged with this logger to be
    ///        passed to the parent for logging.
    LoggerSpecification(const std::string& name = "",
                        isc::log::Severity severity = isc::log::INFO,
                        int dbglevel = 0, bool additive = false) :
        name_(name), severity_(severity), dbglevel_(dbglevel),
        additive_(additive)
    {}

    /// \brief Set the name of the logger.
    ///
    /// \param name Name of the logger.
    void setName(const std::string& name) {
        name_ = name;
    }

    /// \return Return logger name.
    std::string getName() const {
        return name_;
    }

    /// \brief Set the severity.
    ///
    /// \param severity New severity of the logger.
    void setSeverity(isc::log::Severity severity) {
        severity_ = severity;
    }

    /// \return Return logger severity.
    isc::log::Severity getSeverity() const {
        return severity_;
    }

    /// \brief Set the debug level.
    ///
    /// \param dbglevel New debug level of the logger.
    void setDbglevel(int dbglevel) {
        dbglevel_ = dbglevel;
    }

    /// \return Return logger debug level
    int getDbglevel() const {
        return dbglevel_;
    }

    /// \brief Set the additive flag.
    ///
    /// \param additive New value of the additive flag.
    void setAdditive(bool additive) {
        additive_ = additive;
    }

    /// \return Return additive flag.
    bool getAdditive() const {
        return additive_;
    }

    /// \brief Add output option.
    ///
    /// \param option Option to add to the list.
    void addOutputOption(const OutputOption& option) {
        options_.push_back(option);
    }

    /// \return Iterator to start of output options.
    iterator begin() {
        return options_.begin();
    }

    /// \return Iterator to start of output options.
    const_iterator begin() const {
        return options_.begin();
    }

    /// \return Iterator to end of output options.
    iterator end() {
        return options_.end();
    }

    /// \return Iterator to end of output options.
    const_iterator end() const {
        return options_.end();
    }

    /// \return Number of output specification options.
    size_t optionCount() const {
        return options_.size();
    }

    /// \brief Reset back to defaults.
    void reset() {
        name_ = "";
        severity_ = isc::log::INFO;
        dbglevel_ = 0;
        additive_ = false;
        options_.clear();
    }

private:
    std::string                 name_;          ///< Logger name
    isc::log::Severity          severity_;      ///< Severity for this logger
    int                         dbglevel_;      ///< Debug level
    bool                        additive_;      ///< Chaining output
    std::vector<OutputOption>   options_;       ///< Logger options
};

} // namespace log
} // namespace isc

#endif // LOGGER_SPECIFICATION_H