16 const time_t rawtime = time(
nullptr);
20 localtime_s(&timeinfo, &rawtime);
22 localtime_r(&rawtime, &timeinfo);
26 const auto ThreadID = std::hash<std::thread::id>()(std::this_thread::get_id());
28 Buffer,
"[{0:04x}|{1:02d}:{2:02d}:{3:02d}] ",
29 ThreadID, timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec
33 Buffer,
"[{0:02d}:{1:02d}:{2:02d}] ",
34 timeinfo.tm_hour, timeinfo.tm_min, timeinfo.tm_sec
64 fmt::memory_buffer Buffer;
66 fmt::format_to(Buffer,
"{0}\n", a_Message);
67 LogLine(std::string_view(Buffer.data(), Buffer.size()), a_LogLevel);
89 fmt::memory_buffer Buffer;
91 fmt::vprintf(Buffer, fmt::to_string_view(a_Format), a_ArgList);
92 fmt::format_to(Buffer,
"\n");
94 LogLine(std::string_view(Buffer.data(), Buffer.size()), a_LogLevel);
103 fmt::memory_buffer Buffer;
105 fmt::vformat_to(Buffer, a_Format, a_ArgList);
106 fmt::format_to(Buffer,
"\n");
108 LogLine(std::string_view(Buffer.data(), Buffer.size()), a_LogLevel);
117 auto nonOwning = a_Listener.get();
136 [=](std::unique_ptr<cListener> & a_OtherListener) ->
bool
138 return a_OtherListener.get() == a_Listener;
static void WriteLogOpener(fmt::memory_buffer &Buffer)
void LogSimple(std::string_view a_Message, eLogLevel a_LogLevel)
void LogFormat(std::string_view a_Format, eLogLevel a_LogLevel, fmt::format_args a_ArgList)
void LogPrintf(std::string_view a_Format, eLogLevel a_LogLevel, fmt::printf_args a_ArgList)
void LogPrintf(std::string_view a_Format, eLogLevel a_LogLevel, fmt::printf_args a_ArgList)
Log a message formatted with a printf style formatting string.
void LogLine(std::string_view a_Line, eLogLevel a_LogLevel)
static cLogger & GetInstance(void)
void LogFormat(std::string_view a_Format, eLogLevel a_LogLevel, fmt::format_args a_ArgList)
Log a message formatted with a python style formatting string.
void DetachListener(cListener *a_Listener)
static void InitiateMultithreading()
std::vector< std::unique_ptr< cListener > > m_LogListeners
void LogSimple(std::string_view a_Message, eLogLevel a_LogLevel=eLogLevel::Regular)
Logs the simple text message at the specified log level.
cCriticalSection m_CriticalSection
cAttachment AttachListener(std::unique_ptr< cListener > a_Listener)
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.