fixed logging pattern

This commit is contained in:
Chris Punches
2025-03-07 23:53:31 -05:00
parent ee1df1fb0c
commit 34bab86b69
6 changed files with 138 additions and 122 deletions

View File

@@ -1,4 +1,3 @@
// Logger.hpp
#pragma once
#include <fstream>
@@ -31,6 +30,9 @@ public:
// String to LoggingLevels conversion
static LoggingLevels stringToLogLevel(const std::string& level_str, LoggingLevels default_level = LoggingLevels::INFO);
// Convert LoggingLevels enum to string
static std::string LogLevelToString(LoggingLevels level);
private:
// the logging level to stay initialized to
LoggingLevels log_level;

View File

@@ -1,10 +1,12 @@
#pragma once
// Log level enum that will be accessible to modules
enum LoggingLevels {
FATAL = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
DEBUG = 4
};
extern "C" {
// Log level enum that will be accessible to modules
enum LoggingLevels {
FATAL = 0,
ERROR = 1,
WARN = 2,
INFO = 3,
DEBUG = 4
};
}

View File

@@ -35,7 +35,8 @@
#include <iostream>
#include "ConfigManager.hpp"
#include "LoggingLevels.hpp"
#include "Logger.hpp"
/*
* Provides reserved symbol names we look for in modules.
@@ -62,9 +63,9 @@ extern "C" {
// Module description information
const char* dpm_get_description(void);
// Callback function exposed by DPM core for modules to use
int dpm_core_callback(const char* action, const char* data);
// Direct configuration access function
const char* dpm_get_config(const char* section, const char* key);
// Direct logging function
void dpm_log(int level, const char* message);
}