26#ifndef SIM_TO_DUT_INTERFACE_INTERFACELOGGERCONFIG_H
27#define SIM_TO_DUT_INTERFACE_INTERFACELOGGERCONFIG_H
32#include <boost/serialization/access.hpp>
33#include <boost/serialization/nvp.hpp>
41 NONE, DEBUG, INFO, WARNING, ERROR, CRITICAL
73 LoggerConfig(
bool enableDebugMode, std::string pathConsoleLog, std::string pathDataLog,
int fileBackupCount,
75 : enableDebugMode(std::move(enableDebugMode)), pathConsoleLog(std::move(pathConsoleLog)),
76 pathDataLog(std::move(pathDataLog)), fileBackupCount(std::move(fileBackupCount)),
77 fileLogLevel(std::move(fileLogLevel)), consoleLogLevel(std::move(consoleLogLevel)) {
78 if (this->fileBackupCount <= 0) {
79 throw std::invalid_argument(
"FileBackupCount must be greater 0");
81 if (this->pathConsoleLog.empty()) {
82 throw std::invalid_argument(
"The path for consoleLog is not allowed to be empty! May use default configuration.");
84 if (this->pathConsoleLog.empty()) {
85 throw std::invalid_argument(
"The path for consoleLog is not allowed to be empty! May use default configuration.");
89 bool enableDebugMode =
false;
90 std::string pathConsoleLog =
"/logs/console";
91 std::string pathDataLog =
"/logs/data";
92 int fileBackupCount = 10;
94 LOG_LEVEL consoleLogLevel = LOG_LEVEL::INFO;
96 friend class boost::serialization::access;
98 template<
class Archive>
99 void serialize(Archive &ar,
const unsigned int version) {
100 ar & BOOST_SERIALIZATION_NVP(enableDebugMode);
101 ar & BOOST_SERIALIZATION_NVP(pathConsoleLog);
102 ar & BOOST_SERIALIZATION_NVP(pathDataLog);
103 ar & BOOST_SERIALIZATION_NVP(fileBackupCount);
104 ar & BOOST_SERIALIZATION_NVP(fileLogLevel);
105 ar & BOOST_SERIALIZATION_NVP(consoleLogLevel);
The logger needs a configuration before it can start logging.
Definition: InterfaceLoggerConfig.h:50
LoggerConfig(bool enableDebugMode, std::string pathConsoleLog, std::string pathDataLog, int fileBackupCount, LOG_LEVEL fileLogLevel, LOG_LEVEL consoleLogLevel)
Definition: InterfaceLoggerConfig.h:73
void serialize(Archive &ar, sim_interface::dut_connector::ConnectorConfig &config, const unsigned int version)
Definition: ConfigSerializer.h:146
Definition: CANConnector.cpp:29
LOG_LEVEL
Definition: InterfaceLoggerConfig.h:40