feat: Added --verbose command line option to enable debug logs

This commit is contained in:
WerWolv
2024-03-10 15:22:14 +01:00
parent d1a59f8c1b
commit d4d1acb555
5 changed files with 27 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
#include <hex/api/event_manager.hpp>
#include <hex/helpers/logger.hpp>
#include <hex/api/event_manager.hpp>
#include <hex/helpers/fs.hpp>
#include <hex/helpers/fmt.hpp>
@@ -21,6 +22,7 @@ namespace hex::log {
bool s_colorOutputEnabled = false;
std::recursive_mutex s_loggerMutex;
bool s_loggingSuspended = false;
bool s_debugLoggingEnabled = false;
}
@@ -32,6 +34,10 @@ namespace hex::log {
s_loggingSuspended = false;
}
void enableDebugLogging() {
s_debugLoggingEnabled = true;
}
namespace impl {
std::recursive_mutex& getLoggerMutex() {
@@ -42,6 +48,14 @@ namespace hex::log {
return s_loggingSuspended;
}
bool isDebugLoggingEnabled() {
#if defined(DEBUG)
return true;
#else
return s_debugLoggingEnabled;
#endif
}
FILE *getDestination() {
if (s_loggerFile.isValid())
return s_loggerFile.getHandle();