some cleaning up of commandline argument parsing

This commit is contained in:
Chris Punches
2025-03-13 19:15:42 -04:00
parent 80de44b1b6
commit 02c6c5c66a
5 changed files with 131 additions and 19 deletions

View File

@@ -63,3 +63,30 @@ extern "C" void dpm_log(int level, const char* message) {
g_logger.log(log_level, message);
}
extern "C" void dpm_set_logging_level(int level) {
// Convert integer level to LoggingLevels enum
LoggingLevels log_level;
switch (level) {
case 0:
log_level = LoggingLevels::FATAL;
break;
case 1:
log_level = LoggingLevels::ERROR;
break;
case 2:
log_level = LoggingLevels::WARN;
break;
case 3:
log_level = LoggingLevels::INFO;
break;
case 4:
log_level = LoggingLevels::DEBUG;
break;
default:
log_level = LoggingLevels::INFO;
break;
}
g_logger.setLogLevel(log_level);
}