mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add MSVC Output window Journal config setting
Conflicts: src/ripple/peerfinder/impl/Manager.cpp src/ripple/validators/impl/Manager.cpp
This commit is contained in:
@@ -154,6 +154,25 @@
|
||||
#define RIPPLE_TRACK_MUTEXES 0
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_JOURNAL_MSVC_OUTPUT
|
||||
A comma separated string of Journal partition names. The partitions which
|
||||
appear in this list will be logged to the MSVC Output Window if the
|
||||
process is launched from the IDE.
|
||||
*/
|
||||
#ifndef RIPPLE_JOURNAL_MSVC_OUTPUT
|
||||
#define RIPPLE_JOURNAL_MSVC_OUTPUT ""
|
||||
#endif
|
||||
|
||||
/** Config: RIPPLE_JOURNAL_MSVC_OUTPUT_SEVERITY
|
||||
A Journal severity constant. Log entries below this severity that would be
|
||||
destined for the MSVC Output Window will not be reported. This has no
|
||||
effect on partitions not listed in RIPPLE_MSVC_OUTPUT_JOURNALS, or if not
|
||||
running under the MSVC IDE.
|
||||
*/
|
||||
#ifndef RIPPLE_JOURNAL_MSVC_OUTPUT_SEVERITY
|
||||
#define RIPPLE_JOURNAL_MSVC_OUTPUT_SEVERITY Journal::kLowestSeverity
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Here temporarily to turn off new Validations code while it
|
||||
|
||||
@@ -251,15 +251,6 @@ public:
|
||||
, m_messageTimer (this)
|
||||
, m_cacheTimer (this)
|
||||
{
|
||||
#if 1
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger())
|
||||
{
|
||||
m_journal.sink().set_console (true);
|
||||
m_journal.sink().set_severity (Journal::kLowestSeverity);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
~ManagerImp ()
|
||||
|
||||
@@ -62,15 +62,6 @@ public:
|
||||
: m_clock (source)
|
||||
, m_journal (journal)
|
||||
{
|
||||
#if 0
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger())
|
||||
{
|
||||
m_journal.sink().set_console (true);
|
||||
m_journal.sink().set_severity (Journal::kLowestSeverity);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~Logic ()
|
||||
|
||||
@@ -42,16 +42,6 @@ public:
|
||||
, m_logic (journal)
|
||||
, m_journal (journal)
|
||||
{
|
||||
#if 1
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger())
|
||||
{
|
||||
m_journal.sink().set_console (true);
|
||||
m_journal.sink().set_severity (Journal::kLowestSeverity);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Turned off for now, this is for testing
|
||||
//addURL ("https://ripple.com/ripple.txt");
|
||||
}
|
||||
|
||||
@@ -158,15 +158,6 @@ public:
|
||||
, m_checkTimer (this)
|
||||
, m_checkSources (false)
|
||||
{
|
||||
#if 0
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger())
|
||||
{
|
||||
m_journal.sink().set_console (true);
|
||||
m_journal.sink().set_severity (Journal::kLowestSeverity);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
~ManagerImp ()
|
||||
|
||||
@@ -102,16 +102,6 @@ public:
|
||||
, mDeadLock (0)
|
||||
, mCosts (LT_MAX)
|
||||
{
|
||||
#if 0
|
||||
#if BEAST_MSVC
|
||||
if (beast_isRunningUnderDebugger())
|
||||
{
|
||||
m_journal.sink().set_console (true);
|
||||
m_journal.sink().set_severity (Journal::kLowestSeverity);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Flags indicating the type of load.
|
||||
|
||||
Utilization may include any combination of:
|
||||
|
||||
@@ -17,6 +17,75 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
LogJournal::PartitionSinkBase::PartitionSinkBase (LogPartition& partition)
|
||||
: m_partition (partition)
|
||||
, m_severity (Journal::kLowestSeverity)
|
||||
, m_to_console (false)
|
||||
{
|
||||
#ifdef RIPPLE_JOURNAL_MSVC_OUTPUT
|
||||
std::string const& list (RIPPLE_JOURNAL_MSVC_OUTPUT);
|
||||
|
||||
std::string::const_iterator first (list.begin());
|
||||
for(;;)
|
||||
{
|
||||
std::string::const_iterator last (std::find (
|
||||
first, list.end(), ','));
|
||||
|
||||
if (std::equal (first, last, m_partition.getName().begin()))
|
||||
{
|
||||
set_console (true);
|
||||
#ifdef RIPPLE_JOURNAL_MSVC_OUTPUT_SEVERITY
|
||||
set_severity (RIPPLE_JOURNAL_MSVC_OUTPUT_SEVERITY);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if (last != list.end())
|
||||
first = last + 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogJournal::PartitionSinkBase::write (
|
||||
Journal::Severity severity, std::string const& text)
|
||||
{
|
||||
std::string output;
|
||||
LogSeverity const logSeverity (convertSeverity (severity));
|
||||
LogSink::get()->format (output, text, logSeverity,
|
||||
m_partition.getName());
|
||||
LogSink::get()->write (output, logSeverity);
|
||||
#if BEAST_MSVC
|
||||
if (m_to_console && beast_isRunningUnderDebugger ())
|
||||
Logger::outputDebugString (output.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LogJournal::PartitionSinkBase::active (
|
||||
Journal::Severity severity)
|
||||
{
|
||||
return m_partition.doLog (convertSeverity (severity));
|
||||
}
|
||||
|
||||
bool LogJournal::PartitionSinkBase::console()
|
||||
{
|
||||
return m_to_console;
|
||||
}
|
||||
|
||||
void LogJournal::PartitionSinkBase::set_severity (
|
||||
Journal::Severity severity)
|
||||
{
|
||||
LogSeverity const logSeverity (convertSeverity (severity));
|
||||
m_partition.setMinimumSeverity (logSeverity);
|
||||
}
|
||||
|
||||
void LogJournal::PartitionSinkBase::set_console (bool to_console)
|
||||
{
|
||||
m_to_console = to_console;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
LogSeverity LogJournal::convertSeverity (Journal::Severity severity)
|
||||
{
|
||||
|
||||
@@ -30,50 +30,16 @@ public:
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/** A Journal::Sink that writes to the LogPartition with a given Key. */
|
||||
template <class Key>
|
||||
class PartitionSink : public Journal::Sink
|
||||
/** @{ */
|
||||
class PartitionSinkBase : public Journal::Sink
|
||||
{
|
||||
public:
|
||||
PartitionSink ()
|
||||
: m_partition (LogPartition::get <Key> ())
|
||||
, m_severity (Journal::kLowestSeverity)
|
||||
, m_to_console (false)
|
||||
{
|
||||
}
|
||||
|
||||
void write (Journal::Severity severity, std::string const& text)
|
||||
{
|
||||
std::string output;
|
||||
LogSeverity const logSeverity (convertSeverity (severity));
|
||||
LogSink::get()->format (output, text, logSeverity,
|
||||
m_partition.getName());
|
||||
LogSink::get()->write (output, logSeverity);
|
||||
#if BEAST_MSVC
|
||||
if (m_to_console && beast_isRunningUnderDebugger ())
|
||||
Logger::outputDebugString (output.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
bool active (Journal::Severity severity)
|
||||
{
|
||||
return m_partition.doLog (convertSeverity (severity));
|
||||
}
|
||||
|
||||
bool console()
|
||||
{
|
||||
return m_to_console;
|
||||
}
|
||||
|
||||
void set_severity (Journal::Severity severity)
|
||||
{
|
||||
LogSeverity const logSeverity (convertSeverity (severity));
|
||||
m_partition.setMinimumSeverity (logSeverity);
|
||||
}
|
||||
|
||||
void set_console (bool to_console)
|
||||
{
|
||||
m_to_console = to_console;
|
||||
}
|
||||
explicit PartitionSinkBase (LogPartition& partition);
|
||||
void write (Journal::Severity severity, std::string const& text);
|
||||
bool active (Journal::Severity severity);
|
||||
bool console();
|
||||
void set_severity (Journal::Severity severity);
|
||||
void set_console (bool to_console);
|
||||
|
||||
private:
|
||||
LogPartition& m_partition;
|
||||
@@ -81,6 +47,17 @@ public:
|
||||
bool m_to_console;
|
||||
};
|
||||
|
||||
template <class Key>
|
||||
class PartitionSink : public PartitionSinkBase
|
||||
{
|
||||
public:
|
||||
PartitionSink ()
|
||||
: PartitionSinkBase (LogPartition::get <Key> ())
|
||||
{
|
||||
}
|
||||
};
|
||||
/** @} */
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/** Returns a Journal outputting through the LogPartition for the Key. */
|
||||
|
||||
Reference in New Issue
Block a user