mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
that was, in fact, not very thread-safe
This commit is contained in:
parent
c8d1e88a97
commit
7155705f35
1 changed files with 7 additions and 11 deletions
|
@ -222,18 +222,14 @@ std::mutex& getLogMutex() {
|
|||
|
||||
void Logger::push(Severity sev, std::string&& thread, std::string&& source, int32_t nestCount,
|
||||
std::string&& content) {
|
||||
Log* log;
|
||||
{
|
||||
std::lock_guard g(getLogMutex());
|
||||
log = &m_logs.emplace_back(sev, std::move(thread), std::move(source), nestCount,
|
||||
std::lock_guard g(getLogMutex());
|
||||
|
||||
Log& log = m_logs.emplace_back(sev, std::move(thread), std::move(source), nestCount,
|
||||
std::move(content));
|
||||
}
|
||||
auto const logStr = log->toString();
|
||||
{
|
||||
std::lock_guard g(getLogMutex());
|
||||
console::log(logStr, log->getSeverity());
|
||||
m_logStream << logStr << std::endl;
|
||||
}
|
||||
|
||||
auto const logStr = log.toString();
|
||||
console::log(logStr, log.getSeverity());
|
||||
m_logStream << logStr << std::endl;
|
||||
}
|
||||
|
||||
Nest::Nest(std::shared_ptr<Nest::Impl> impl) : m_impl(std::move(impl)) { }
|
||||
|
|
Loading…
Reference in a new issue