vengine
0.0.1
3D graphics engine
Loading...
Searching...
No Matches
logger.cpp
Go to the documentation of this file.
1
#include "
VEngine/Utils/Logger.hpp
"
2
3
ven::Logger::Logger
()
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
14
std::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
}
Logger.hpp
This file contains the Logger class.
ven::Logger::Logger
Logger()
Definition
logger.cpp:3
ven::Logger::formatLogMessage
static std::string formatLogMessage(LogLevel level, const std::string &message)
Definition
logger.cpp:14
ven::LogLevel
LogLevel
Definition
Logger.hpp:23
src
Utils
logger.cpp
Generated by
1.11.0