mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Journal console output improvements
This commit is contained in:
@@ -22,15 +22,7 @@
|
||||
namespace beast
|
||||
{
|
||||
|
||||
bool Journal::Sink::active (Severity)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Journal::Sink::console ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// A Sink that does nothing.
|
||||
class NullJournalSink : public Journal::Sink
|
||||
@@ -45,7 +37,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool console (Journal::Severity)
|
||||
bool console ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -94,11 +86,6 @@ Journal::ScopedStream::~ScopedStream ()
|
||||
{
|
||||
if (m_sink.active (m_severity))
|
||||
m_sink.write (m_severity, m_ostream.str());
|
||||
|
||||
#if BEAST_MSVC
|
||||
if (m_sink.console () && beast_isRunningUnderDebugger ())
|
||||
Logger::outputDebugString (m_ostream.str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +103,7 @@ std::ostringstream& Journal::ScopedStream::ostream () const
|
||||
|
||||
Journal::Stream::Stream ()
|
||||
: m_sink (&getNullSink ())
|
||||
, m_severity (kFatal)
|
||||
, m_severity (kDisabled)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -124,6 +111,7 @@ Journal::Stream::Stream (Sink& sink, Severity severity)
|
||||
: m_sink (&sink)
|
||||
, m_severity (severity)
|
||||
{
|
||||
bassert (severity != kDisabled);
|
||||
}
|
||||
|
||||
Journal::Stream::Stream (Stream const& other)
|
||||
@@ -132,16 +120,6 @@ Journal::Stream::Stream (Stream const& other)
|
||||
{
|
||||
}
|
||||
|
||||
bool Journal::Stream::active () const
|
||||
{
|
||||
return m_sink->active (m_severity);
|
||||
}
|
||||
|
||||
bool Journal::Stream::console() const
|
||||
{
|
||||
return m_sink->console ();
|
||||
}
|
||||
|
||||
Journal::Sink& Journal::Stream::sink () const
|
||||
{
|
||||
return *m_sink;
|
||||
@@ -152,6 +130,11 @@ Journal::Severity Journal::Stream::severity () const
|
||||
return m_severity;
|
||||
}
|
||||
|
||||
bool Journal::Stream::active () const
|
||||
{
|
||||
return m_sink->active (m_severity);
|
||||
}
|
||||
|
||||
Journal::Stream& Journal::Stream::operator= (Stream const& other)
|
||||
{
|
||||
m_sink = other.m_sink;
|
||||
@@ -203,25 +186,20 @@ Journal::~Journal ()
|
||||
{
|
||||
}
|
||||
|
||||
Journal::Stream Journal::stream (Severity severity) const
|
||||
{
|
||||
return Stream (*m_sink, severity);
|
||||
}
|
||||
|
||||
Journal::Sink& Journal::sink() const
|
||||
{
|
||||
return *m_sink;
|
||||
}
|
||||
|
||||
/** Returns `true` if the sink logs messages at that severity. */
|
||||
Journal::Stream Journal::stream (Severity severity) const
|
||||
{
|
||||
return Stream (*m_sink, severity);
|
||||
}
|
||||
|
||||
bool Journal::active (Severity severity) const
|
||||
{
|
||||
bassert (severity != kDisabled);
|
||||
return m_sink->active (severity);
|
||||
}
|
||||
|
||||
bool Journal::console () const
|
||||
{
|
||||
return m_sink->console ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user