forked from boostorg/beast
Access Journal::Stream using member functions (RIPD-1087):
Replace Journal public data members with member function accessors in order to make Journal lighter weight. The change makes a Journal cheaper to pass by value. Also add missing stream checks (e.g., calls to JLOG) to avoid text processing that ultimately will not be stored in the log.
This commit is contained in:
1 parent
f6bec473d5
commit
388fd1262a
6 files changed
+236
-219
No files matched your search
@@ -117,7 +117,8 @@ void Stoppable::stopAsyncRecursive (Journal j)
|
||||
|
||||
#ifdef NDEBUG
|
||||
if (ms >= 10)
|
||||
j.fatal << m_name << "::onStop took " << ms << "ms";
|
||||
if (auto stream = j.fatal())
|
||||
stream << m_name << "::onStop took " << ms << "ms";
|
||||
#else
|
||||
(void)ms;
|
||||
#endif
|
||||
@@ -145,7 +146,8 @@ void Stoppable::stopRecursive (Journal j)
|
||||
bool const timedOut (! m_stoppedEvent.wait (1 * 1000)); // milliseconds
|
||||
if (timedOut)
|
||||
{
|
||||
j.error << "Waiting for '" << m_name << "' to stop";
|
||||
if (auto stream = j.error())
|
||||
stream << "Waiting for '" << m_name << "' to stop";
|
||||
m_stoppedEvent.wait ();
|
||||
}
|
||||
|
||||
@@ -193,7 +195,8 @@ void RootStoppable::stop (Journal j)
|
||||
std::lock_guard<std::mutex> lock(m_);
|
||||
if (m_calledStop)
|
||||
{
|
||||
j.warning << "Stoppable::stop called again";
|
||||
if (auto stream = j.warn())
|
||||
stream << "Stoppable::stop called again";
|
||||
return;
|
||||
}
|
||||
m_calledStop = true;
|
||||
|
||||
Reference in new issue
Block a user