34 inline static std::string levelToString(
LogLevel level) {
40 default:
return "UNKNOWN";
55 static std::ofstream logFile;
69 if (level <= minLogLevel) {
return; }
70 if (!logFile.is_open()) {
71 std::cerr <<
"Error opening log file" << std::endl;
75 auto now = std::chrono::system_clock::now();
76 std::time_t now_c = std::chrono::system_clock::to_time_t(now);
77 logFile << std::put_time(std::localtime(&now_c),
"[%F %T]") <<
" ";
78 logFile << levelToString(level) <<
": ";
79 logFile << message << std::endl;
93 std::cout << message << std::endl;
static void logMessage(LogLevel level, const std::string &message)
Logs a message.
Definition logger.h:68
static void DebugLogMessageToConsole(const std::string &message)
Debug log message to console.
Definition logger.h:90
LogLevel
Values that represent log levels.
Definition logger.h:17