Skip to content

Commit

Permalink
Logger: Fix issue where delayed log messages didn't record the correc…
Browse files Browse the repository at this point in the history
…t "source" in some cases
  • Loading branch information
brianferguson committed Feb 8, 2022
1 parent b8d3357 commit 2835d84
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Library/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void Logger::Log(Level level, const WCHAR* source, const WCHAR* msg)
{
Level level;
std::chrono::system_clock::time_point timestamp;
std::wstring source;
std::wstring message;
};
static std::list<DelayedEntry> s_DelayedEntries;
Expand All @@ -190,7 +191,7 @@ void Logger::Log(Level level, const WCHAR* source, const WCHAR* msg)
while (!s_DelayedEntries.empty())
{
DelayedEntry& entry = s_DelayedEntries.front();
LogInternal(entry.level, entry.timestamp, source, entry.message.c_str());
LogInternal(entry.level, entry.timestamp, entry.source.c_str(), entry.message.c_str());

s_DelayedEntries.erase(s_DelayedEntries.begin());
}
Expand All @@ -207,7 +208,7 @@ void Logger::Log(Level level, const WCHAR* source, const WCHAR* msg)
// Queue message.
EnterCriticalSection(&m_CsLogDelay);

DelayedEntry entry = {level, timestamp, msg};
DelayedEntry entry = {level, timestamp, source, msg};
s_DelayedEntries.push_back(entry);

LeaveCriticalSection(&m_CsLogDelay);
Expand Down

0 comments on commit 2835d84

Please sign in to comment.