vengine  0.0.1
3D graphics engine
Loading...
Searching...
No Matches
logger.cpp
Go to the documentation of this file.
2
4{
5#ifdef _WIN32
6 const HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
7 DWORD dwMode = 0;
8 if (hOut != INVALID_HANDLE_VALUE && (GetConsoleMode(hOut, &dwMode) != 0)) {
9 SetConsoleMode(hOut, dwMode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
10 }
11#endif
12}
13
14std::string ven::Logger::formatLogMessage(const LogLevel level, const std::string& message)
15{
16 const auto inTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
17
18 std::ostringstream ss;
19 ss << "[" << std::put_time(std::localtime(&inTime), "%Y-%m-%d %X") << "] ";
20 ss << "[" << LOG_LEVEL_STRING.at(static_cast<uint8_t>(level)) << "] " << message;
21
22 return ss.str();
23}
This file contains the Logger class.
static std::string formatLogMessage(LogLevel level, const std::string &message)
Definition logger.cpp:14
LogLevel
Definition Logger.hpp:23