Kea: isc::process::LogConfigParser Class Reference

| Kea 3.0.0

isc::process::LogConfigParser Class Reference

Configures log4cplus by translating Kea configuration structures. More...

`#include <log_parser.h>`

## Public Member Functions
| LogConfigParser (const ConfigPtr &storage)
| Constructor.
void | parseConfiguration (const isc::data::ConstElementPtr &log_config, bool verbose=false)
| Parses specified configuration.

## Static Public Member Functions
static std::string | getLogPath (bool reset=false, const std::string explicit_path="")
| Fetches the supported log file path.
static std::string | validatePath (const std::string logpath)
| Validates a library path against the supported path for log files.

## Detailed Description

Configures log4cplus by translating Kea configuration structures.

This parser iterates over provided data elements and translates them into values applicable to log4cplus.

The data structures converted to JSON format have the following syntax: { "name": "kea", "output-options": [ { "output": "/home/thomson/kea-inst/kea-warn.log", "maxver": 8, "maxsize": 204800, "flush": true } ], "severity": "WARN" }

This is only an example and actual values may be different.

The data structures don't have to originate from JSON. JSON is just a convenient presentation syntax.

This class uses `ConfigBase` object to store logging configuration.

Definition at line 43 of file log_parser.h.

## Constructor & Destructor Documentation

## ◆ LogConfigParser()

isc::process::LogConfigParser::LogConfigParser | ( | const ConfigPtr & | storage | ) |

Constructor.

Parameters

  storage | parsed logging configuration will be stored here

Definition at line 30 of file log_parser.cc.

References isc_throw.

## Member Function Documentation

## ◆ getLogPath()

std::string isc::process::LogConfigParser::getLogPath | ( | bool | reset = false,
|  | const std::string | explicit_path = "" )
| static

Fetches the supported log file path.

The first call to this function with no arguments will set the default hooks path to either the value of LOGFILE_DIR or the environment variable KEA_LOG_FILE_DIR if it is defined. Subsequent calls with no arguments will simply return this value.

Parameters

  reset | recalculate when true, defaults to false.
  explicit_path | set default log path to this value. This is for testing purposes only.

Returns
  String containing the default log file path.

Definition at line 137 of file log_parser.cc.

Referenced by validatePath().

## ◆ parseConfiguration()

void isc::process::LogConfigParser::parseConfiguration | ( | const isc::data::ConstElementPtr & | log_config,
|  | bool | verbose = false )

Parses specified configuration.

Walks over specified logging configuration JSON structures and store parsed information in config_->logging_info_.

Parameters

  log_config | JSON structures to be parsed (loggers list)
  verbose | specifies verbose mode (true forces DEBUG, debuglevel = 99)

Definition at line 38 of file log_parser.cc.

Referenced by isc::process::Daemon::configureLogger().

## ◆ validatePath()

std::string isc::process::LogConfigParser::validatePath | ( | const std::string | logpath | ) |
| static

Validates a library path against the supported path for log files.

Parameters

  logpath | path to validate.

Returns
  validated path

Definition at line 149 of file log_parser.cc.

References getLogPath().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- log_parser.h
- log_parser.cc