diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 116a99d4a..049790aa2 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -75,13 +75,14 @@
advapi32.lib;comdlg32.lib;gdi32.lib;kernel32.lib;libeay32MT.lib;odbc32.lib;odbccp32.lib;ole32.lib;oleaut32.lib;shell32.lib;Shlwapi.lib;ssleay32MT.lib;user32.lib;uuid.lib;winspool.lib;%(AdditionalDependencies)
+ True
NoErrorReport
Console
True
true
True
MachineX64
- /MANIFEST /nologo /TLBID:1 %(AdditionalOptions)
+ /MANIFEST /TLBID:1 %(AdditionalOptions)
@@ -109,13 +110,14 @@
advapi32.lib;comdlg32.lib;gdi32.lib;kernel32.lib;libeay32MT.lib;odbc32.lib;odbccp32.lib;ole32.lib;oleaut32.lib;shell32.lib;Shlwapi.lib;ssleay32MT.lib;user32.lib;uuid.lib;winspool.lib;%(AdditionalDependencies)
+ True
NoErrorReport
Console
True
true
True
MachineX64
- /MANIFEST /nologo /TLBID:1 %(AdditionalOptions)
+ /MANIFEST /TLBID:1 %(AdditionalOptions)
@@ -1142,6 +1144,9 @@
+
+ True
+
True
@@ -1791,23 +1796,6 @@
-
- True
-
-
-
-
- True
-
-
-
-
-
-
- True
-
-
-
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index f74b03278..91f61eb75 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -1926,6 +1926,9 @@
beast\utility
+
+ beast\utility\tests
+
beast\utility\tests
@@ -2727,27 +2730,6 @@
ripple\basics\log
-
- ripple\basics\log
-
-
- ripple\basics\log
-
-
- ripple\basics\log
-
-
- ripple\basics\log
-
-
- ripple\basics\log
-
-
- ripple\basics\log
-
-
- ripple\basics\log
-
ripple\basics\log
diff --git a/src/beast/beast/module/core/text/LexicalCast.h b/src/beast/beast/module/core/text/LexicalCast.h
index ebaf52275..8e1f4a471 100644
--- a/src/beast/beast/module/core/text/LexicalCast.h
+++ b/src/beast/beast/module/core/text/LexicalCast.h
@@ -20,12 +20,13 @@
#ifndef BEAST_LEXICALCAST_H_INCLUDED
#define BEAST_LEXICALCAST_H_INCLUDED
-#include
+#include
#include //
#include
#include
#include
+#include
#include
namespace beast {
diff --git a/src/beast/beast/module/core/thread/DeadlineTimer.h b/src/beast/beast/module/core/thread/DeadlineTimer.h
index 0d8923868..0cc96f208 100644
--- a/src/beast/beast/module/core/thread/DeadlineTimer.h
+++ b/src/beast/beast/module/core/thread/DeadlineTimer.h
@@ -20,8 +20,9 @@
#ifndef BEAST_DEADLINETIMER_H_INCLUDED
#define BEAST_DEADLINETIMER_H_INCLUDED
-namespace beast
-{
+#include
+
+namespace beast {
/** Provides periodic or one time notifications at a specified time interval.
*/
diff --git a/src/beast/beast/utility/Utility.unity.cpp b/src/beast/beast/utility/Utility.unity.cpp
index 0b6cbe796..a0e29bcd7 100644
--- a/src/beast/beast/utility/Utility.unity.cpp
+++ b/src/beast/beast/utility/Utility.unity.cpp
@@ -31,5 +31,6 @@
#include
#include
-#include
+#include
#include
+#include
diff --git a/src/beast/beast/utility/impl/Journal.cpp b/src/beast/beast/utility/impl/Journal.cpp
index 3a5c030f5..25ee34609 100644
--- a/src/beast/beast/utility/impl/Journal.cpp
+++ b/src/beast/beast/utility/impl/Journal.cpp
@@ -67,7 +67,7 @@ Journal::Sink& Journal::getNullSink ()
//------------------------------------------------------------------------------
Journal::Sink::Sink ()
- : m_level (kAll)
+ : m_level (kWarning)
, m_console (false)
{
}
diff --git a/src/beast/beast/utility/tests/Journal.test.cpp b/src/beast/beast/utility/tests/Journal.test.cpp
new file mode 100644
index 000000000..b08f48b10
--- /dev/null
+++ b/src/beast/beast/utility/tests/Journal.test.cpp
@@ -0,0 +1,100 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of Beast: https://github.com/vinniefalco/Beast
+ Copyright 2013, Vinnie Falco
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include
+#include
+
+namespace beast {
+
+class Journal_test : public unit_test::suite
+{
+public:
+ class TestSink : public Journal::Sink
+ {
+ private:
+ int m_count;
+
+ public:
+ TestSink()
+ : m_count(0)
+ {
+ }
+
+ int
+ count() const
+ {
+ return m_count;
+ }
+
+ void
+ reset()
+ {
+ m_count = 0;
+ }
+
+ void
+ write (Journal::Severity, std::string const&)
+ {
+ ++m_count;
+ }
+ };
+
+ void run ()
+ {
+ TestSink sink;
+
+ sink.severity(Journal::kInfo);
+
+ Journal j(sink);
+
+ j.trace << " ";
+ expect(sink.count() == 0);
+ j.debug << " ";
+ expect(sink.count() == 0);
+ j.info << " ";
+ expect(sink.count() == 1);
+ j.warning << " ";
+ expect(sink.count() == 2);
+ j.error << " ";
+ expect(sink.count() == 3);
+ j.fatal << " ";
+ expect(sink.count() == 4);
+
+ sink.reset();
+
+ sink.severity(Journal::kDebug);
+
+ j.trace << " ";
+ expect(sink.count() == 0);
+ j.debug << " ";
+ expect(sink.count() == 1);
+ j.info << " ";
+ expect(sink.count() == 2);
+ j.warning << " ";
+ expect(sink.count() == 3);
+ j.error << " ";
+ expect(sink.count() == 4);
+ j.fatal << " ";
+ expect(sink.count() == 5);
+ }
+};
+
+BEAST_DEFINE_TESTSUITE_MANUAL(Journal,utility,beast);
+
+} // beast
diff --git a/src/ripple/basics/containers/RangeSet.cpp b/src/ripple/basics/containers/RangeSet.cpp
index 281aff594..e00433116 100644
--- a/src/ripple/basics/containers/RangeSet.cpp
+++ b/src/ripple/basics/containers/RangeSet.cpp
@@ -26,8 +26,6 @@
namespace ripple {
-SETUP_LOG (RangeSet)
-
// VFALCO NOTE std::min and std::max not good enough?
// NOTE Why isn't this written as a template?
// TODO Replace this with std calls.
diff --git a/src/ripple/basics/log/Log.cpp b/src/ripple/basics/log/Log.cpp
index c21e06fb9..fed6842f9 100644
--- a/src/ripple/basics/log/Log.cpp
+++ b/src/ripple/basics/log/Log.cpp
@@ -18,95 +18,252 @@
//==============================================================================
#include
+// VFALCO TODO Use std::chrono
+#include
+#include
namespace ripple {
-Log::Log (LogSeverity s)
- : m_level (s)
- , m_partition (nullptr)
+Logs::Sink::Sink (std::string const& partition, Logs& logs)
+ : logs_(logs)
+ , partition_(partition)
{
}
-Log::Log (LogSeverity s, LogPartition& partition)
- : m_level (s)
- , m_partition (&partition)
+bool
+Logs::Sink::active (beast::Journal::Severity level) const
+{
+ return level >= logs_.severity() &&
+ level >= beast::Journal::Sink::severity();
+}
+
+beast::Journal::Severity
+Logs::Sink::severity() const
+{
+ return beast::Journal::Sink::severity();
+}
+
+void
+Logs::Sink::severity (beast::Journal::Severity level)
+{
+ std::lock_guard lock (logs_.mutex_);
+ beast::Journal::Sink::severity(level);
+}
+
+//------------------------------------------------------------------------------
+
+void
+Logs::Sink::write (beast::Journal::Severity level, std::string const& text)
+{
+ logs_.write (level, partition_, text, console());
+}
+
+Logs::File::File()
+ : m_stream (nullptr)
{
}
-Log::~Log ()
+Logs::File::~File()
{
- if (m_partition != nullptr)
+}
+
+bool Logs::File::isOpen () const noexcept
+{
+ return m_stream != nullptr;
+}
+
+bool Logs::File::open (boost::filesystem::path const& path)
+{
+ close ();
+
+ bool wasOpened = false;
+
+ // VFALCO TODO Make this work with Unicode file paths
+ std::unique_ptr stream (
+ new std::ofstream (path.c_str (), std::fstream::app));
+
+ if (stream->good ())
{
- if (m_partition->doLog (m_level))
- m_partition->write (
- LogPartition::convertLogSeverity (m_level), m_os.str());
+ m_path = path;
+
+ m_stream = std::move (stream);
+
+ wasOpened = true;
}
- else
+
+ return wasOpened;
+}
+
+bool Logs::File::closeAndReopen ()
+{
+ close ();
+
+ return open (m_path);
+}
+
+void Logs::File::close ()
+{
+ m_stream = nullptr;
+}
+
+void Logs::File::write (char const* text)
+{
+ if (m_stream != nullptr)
+ (*m_stream) << text;
+}
+
+void Logs::File::writeln (char const* text)
+{
+ if (m_stream != nullptr)
{
- LogSink::get()->write (m_os.str(), m_level, "");
+ (*m_stream) << text;
+ (*m_stream) << std::endl;
}
}
//------------------------------------------------------------------------------
-std::string Log::replaceFirstSecretWithAsterisks (std::string s)
+Logs::Logs()
+ : level_ (beast::Journal::kWarning) // default severity
{
- using namespace std;
-
- char const* secretToken = "\"secret\"";
-
- // Look for the first occurrence of "secret" in the string.
- //
- size_t startingPosition = s.find (secretToken);
-
- if (startingPosition != string::npos)
- {
- // Found it, advance past the token.
- //
- startingPosition += strlen (secretToken);
-
- // Replace the next 35 characters at most, without overwriting the end.
- //
- size_t endingPosition = std::min (startingPosition + 35, s.size () - 1);
-
- for (size_t i = startingPosition; i < endingPosition; ++i)
- s [i] = '*';
- }
-
- return s;
+}
+
+void
+Logs::open (boost::filesystem::path const& pathToLogFile)
+{
+ file_.open(pathToLogFile);
}
-//------------------------------------------------------------------------------
+Logs::Sink&
+Logs::get (std::string const& name)
+{
+ std::lock_guard lock (mutex_);
+ auto const result (sinks_.emplace(std::piecewise_construct,
+ std::forward_as_tuple(name), std::forward_as_tuple(name, *this)));
+ return result.first->second;
+}
-std::string Log::severityToString (LogSeverity s)
+Logs::Sink&
+Logs::operator[] (std::string const& name)
+{
+ return get(name);
+}
+
+beast::Journal
+Logs::journal (std::string const& name)
+{
+ return beast::Journal (get(name));
+}
+
+beast::Journal::Severity
+Logs::severity() const
+{
+ return level_;
+}
+
+void
+Logs::severity (beast::Journal::Severity level)
+{
+ // VFALCO Do we need the lock?
+ level_ = level;
+}
+
+std::vector>
+Logs::partition_severities() const
+{
+ std::vector> list;
+ std::lock_guard lock (mutex_);
+ list.reserve (sinks_.size());
+ for (auto const& e : sinks_)
+ list.push_back(std::make_pair(e.first,
+ toString(fromSeverity(e.second.severity()))));
+ return list;
+}
+
+void
+Logs::write (beast::Journal::Severity level, std::string const& partition,
+ std::string const& text, bool console)
+{
+ std::string s;
+ format (s, text, level, partition);
+ std::lock_guard lock (mutex_);
+ file_.writeln (s);
+ std::cerr << s << '\n';
+ // VFALCO TODO Fix console output
+ //if (console)
+ // out_.write_console(s);
+}
+
+std::string
+Logs::rotate()
+{
+ std::lock_guard lock (mutex_);
+ bool const wasOpened = file_.closeAndReopen ();
+ if (wasOpened)
+ return "The log file was closed and reopened.";
+ return "The log file could not be closed and reopened.";
+}
+
+LogSeverity
+Logs::fromSeverity (beast::Journal::Severity level)
+{
+ using beast::Journal;
+ switch (level)
+ {
+ case Journal::kTrace: return lsTRACE;
+ case Journal::kDebug: return lsDEBUG;
+ case Journal::kInfo: return lsINFO;
+ case Journal::kWarning: return lsWARNING;
+ case Journal::kError: return lsERROR;
+
+ default:
+ bassertfalse;
+ case Journal::kFatal:
+ break;
+ }
+
+ return lsFATAL;
+}
+
+beast::Journal::Severity
+Logs::toSeverity (LogSeverity level)
+{
+ using beast::Journal;
+ switch (level)
+ {
+ case lsTRACE: return Journal::kTrace;
+ case lsDEBUG: return Journal::kDebug;
+ case lsINFO: return Journal::kInfo;
+ case lsWARNING: return Journal::kWarning;
+ case lsERROR: return Journal::kError;
+ default:
+ bassertfalse;
+ case lsFATAL:
+ break;
+ }
+
+ return Journal::kFatal;
+}
+
+std::string
+Logs::toString (LogSeverity s)
{
switch (s)
{
- case lsTRACE:
- return "Trace";
-
- case lsDEBUG:
- return "Debug";
-
- case lsINFO:
- return "Info";
-
- case lsWARNING:
- return "Warning";
-
- case lsERROR:
- return "Error";
-
- case lsFATAL:
- return "Fatal";
-
+ case lsTRACE: return "Trace";
+ case lsDEBUG: return "Debug";
+ case lsINFO: return "Info";
+ case lsWARNING: return "Warning";
+ case lsERROR: return "Error";
+ case lsFATAL: return "Fatal";
default:
assert (false);
return "Unknown";
}
}
-LogSeverity Log::stringToSeverity (const std::string& s)
+LogSeverity
+Logs::fromString (std::string const& s)
{
if (boost::iequals (s, "trace"))
return lsTRACE;
@@ -129,4 +286,58 @@ LogSeverity Log::stringToSeverity (const std::string& s)
return lsINVALID;
}
+// Replace the first secret, if any, with asterisks
+std::string
+Logs::scrub (std::string s)
+{
+ using namespace std;
+ char const* secretToken = "\"secret\"";
+ // Look for the first occurrence of "secret" in the string.
+ size_t startingPosition = s.find (secretToken);
+ if (startingPosition != string::npos)
+ {
+ // Found it, advance past the token.
+ startingPosition += strlen (secretToken);
+ // Replace the next 35 characters at most, without overwriting the end.
+ size_t endingPosition = std::min (startingPosition + 35, s.size () - 1);
+ for (size_t i = startingPosition; i < endingPosition; ++i)
+ s [i] = '*';
+ }
+ return s;
+}
+
+void
+Logs::format (std::string& output, std::string const& message,
+ beast::Journal::Severity severity, std::string const& partition)
+{
+ output.reserve (message.size() + partition.size() + 100);
+
+ output = boost::posix_time::to_simple_string (
+ boost::posix_time::second_clock::universal_time ());
+
+ output += " ";
+ if (! partition.empty ())
+ output += partition + ":";
+
+ switch (severity)
+ {
+ case beast::Journal::kTrace: output += "TRC "; break;
+ case beast::Journal::kDebug: output += "DBG "; break;
+ case beast::Journal::kInfo: output += "NFO "; break;
+ case beast::Journal::kWarning: output += "WRN "; break;
+ case beast::Journal::kError: output += "ERR "; break;
+ default:
+ bassertfalse;
+ case beast::Journal::kFatal: output += "FTL "; break;
+ }
+
+ output += scrub (message);
+
+ if (output.size() > maximumMessageCharacters)
+ {
+ output.resize (maximumMessageCharacters - 3);
+ output += "...";
+ }
+}
+
} // ripple
diff --git a/src/ripple/basics/log/Log.h b/src/ripple/basics/log/Log.h
index 6bcae4682..a53f4213d 100644
--- a/src/ripple/basics/log/Log.h
+++ b/src/ripple/basics/log/Log.h
@@ -20,67 +20,221 @@
#ifndef RIPPLE_BASICS_LOG_H_INCLUDED
#define RIPPLE_BASICS_LOG_H_INCLUDED
-#include
-#include
-#include
+#include
+#include
+#include
+#include
+#include
+#include
namespace ripple {
-/** RAII helper for writing to the LogSink. */
-class Log : public beast::Uncopyable
+// DEPRECATED use beast::Journal::Severity instead
+enum LogSeverity
{
-public:
- explicit Log (LogSeverity s);
- Log (LogSeverity s, LogPartition& partition);
- ~Log ();
-
- template
- std::ostream& operator<< (const T& t) const
- {
- return m_os << t;
- }
-
- std::ostringstream& ref () const
- {
- return m_os;
- }
-
-public:
- static std::string severityToString (LogSeverity);
- static LogSeverity stringToSeverity (std::string const&);
-
- // VFALCO DEPRECATED
- class out
- {
- public:
- out () { }
- ~out () { LogSink::get()->write (m_ss.str ()); }
- template
- out& operator<< (T t)
- { m_ss << t; return *this; }
- private:
- std::stringstream m_ss;
- };
-
-private:
- static std::string replaceFirstSecretWithAsterisks (std::string s);
-
- mutable std::ostringstream m_os;
- LogSeverity m_level;
- LogPartition* m_partition;
+ lsINVALID = -1, // used to indicate an invalid severity
+ lsTRACE = 0, // Very low-level progress information, details inside an operation
+ lsDEBUG = 1, // Function-level progress information, operations
+ lsINFO = 2, // Server-level progress information, major operations
+ lsWARNING = 3, // Conditions that warrant human attention, may indicate a problem
+ lsERROR = 4, // A condition that indicates a problem
+ lsFATAL = 5 // A severe condition that indicates a server problem
};
-// Manually test for whether we should log
-//
-#define ShouldLog(s, k) (LogPartition::get ().doLog (s))
+/** Manages partitions for logging. */
+class Logs
+{
+private:
+ class Sink : public beast::Journal::Sink
+ {
+ private:
+ Logs& logs_;
+ std::string partition_;
-// Write to the log at the given severity level
-//
-#define WriteLog(s, k) if (!ShouldLog (s, k)) do {} while (0); else Log (s, LogPartition::get ())
+ public:
+ Sink (std::string const& partition, Logs& logs);
-// Write to the log conditionally
-//
-#define CondLog(c, s, k) if (!ShouldLog (s, k) || !(c)) do {} while(0); else Log(s, LogPartition::get ())
+ Sink (Sink const&) = delete;
+ Sink& operator= (Sink const&) = delete;
+
+ bool
+ active (beast::Journal::Severity level) const override;
+
+ beast::Journal::Severity
+ severity() const override;
+
+ void
+ severity (beast::Journal::Severity level) override;
+
+ void
+ write (beast::Journal::Severity level, std::string const& text) override;
+ };
+
+ /** Manages a system file containing logged output.
+ The system file remains open during program execution. Interfaces
+ are provided for interoperating with standard log management
+ tools like logrotate(8):
+ http://linuxcommand.org/man_pages/logrotate8.html
+ @note None of the listed interfaces are thread-safe.
+ */
+ class File
+ {
+ public:
+ /** Construct with no associated system file.
+ A system file may be associated later with @ref open.
+ @see open
+ */
+ File ();
+
+ /** Destroy the object.
+ If a system file is associated, it will be flushed and closed.
+ */
+ ~File ();
+
+ /** Determine if a system file is associated with the log.
+ @return `true` if a system file is associated and opened for writing.
+ */
+ bool isOpen () const noexcept;
+
+ /** Associate a system file with the log.
+ If the file does not exist an attempt is made to create it
+ and open it for writing. If the file already exists an attempt is
+ made to open it for appending.
+ If a system file is already associated with the log, it is closed first.
+ @return `true` if the file was opened.
+ */
+ // VFALCO NOTE The parameter is unfortunately a boost type because it
+ // can be either wchar or char based depending on platform.
+ // TODO Replace with beast::File
+ //
+ bool open (boost::filesystem::path const& path);
+
+ /** Close and re-open the system file associated with the log
+ This assists in interoperating with external log management tools.
+ @return `true` if the file was opened.
+ */
+ bool closeAndReopen ();
+
+ /** Close the system file if it is open. */
+ void close ();
+
+ /** write to the log file.
+ Does nothing if there is no associated system file.
+ */
+ void write (char const* text);
+
+ /** write to the log file and append an end of line marker.
+ Does nothing if there is no associated system file.
+ */
+ void writeln (char const* text);
+
+ /** Write to the log file using std::string. */
+ /** @{ */
+ void write (std::string const& str)
+ {
+ write (str.c_str ());
+ }
+
+ void writeln (std::string const& str)
+ {
+ writeln (str.c_str ());
+ }
+ /** @} */
+
+ private:
+ std::unique_ptr m_stream;
+ boost::filesystem::path m_path;
+ };
+
+ std::mutex mutable mutex_;
+ std::unordered_map sinks_;
+ beast::Journal::Severity level_;
+ File file_;
+
+public:
+ Logs();
+
+ Logs (Logs const&) = delete;
+ Logs& operator= (Logs const&) = delete;
+
+ void
+ open (boost::filesystem::path const& pathToLogFile);
+
+ Sink&
+ get (std::string const& name);
+
+ Sink&
+ operator[] (std::string const& name);
+
+ beast::Journal
+ journal (std::string const& name);
+
+ beast::Journal::Severity
+ severity() const;
+
+ void
+ severity (beast::Journal::Severity level);
+
+ std::vector>
+ partition_severities() const;
+
+ void
+ write (beast::Journal::Severity level, std::string const& partition,
+ std::string const& text, bool console);
+
+ std::string
+ rotate();
+
+public:
+ static
+ LogSeverity
+ fromSeverity (beast::Journal::Severity level);
+
+ static
+ beast::Journal::Severity
+ toSeverity (LogSeverity level);
+
+ static
+ std::string
+ toString (LogSeverity s);
+
+ static
+ LogSeverity
+ fromString (std::string const& s);
+
+private:
+ enum
+ {
+ // Maximum line length for log messages.
+ // If the message exceeds this length it will be truncated with elipses.
+ maximumMessageCharacters = 12 * 1024
+ };
+
+ static
+ std::string
+ scrub (std::string s);
+
+ static
+ void
+ format (std::string& output, std::string const& message,
+ beast::Journal::Severity severity, std::string const& partition);
+};
+
+//------------------------------------------------------------------------------
+// VFALCO DEPRECATED Temporary transition function until interfaces injected
+inline
+Logs&
+deprecatedLogs()
+{
+ static Logs logs;
+ return logs;
+}
+// VFALCO DEPRECATED Inject beast::Journal instead
+#define ShouldLog(s, k) deprecatedLogs()[#k].active(Logs::toSeverity(s))
+#define WriteLog(s, k) if (!ShouldLog (s, k)) do {} while (0); else \
+ beast::Journal::Stream(deprecatedLogs()[#k], Logs::toSeverity(s))
+#define CondLog(c, s, k) if (!ShouldLog (s, k) || !(c)) do {} while(0); else \
+ beast::Journal::Stream(deprecatedLogs()[#k], Logs::toSeverity(s))
} // ripple
diff --git a/src/ripple/basics/log/LogFile.cpp b/src/ripple/basics/log/LogFile.cpp
deleted file mode 100644
index c3b6aa8bc..000000000
--- a/src/ripple/basics/log/LogFile.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#include //
-#include
-
-namespace ripple {
-
-LogFile::LogFile ()
- : m_stream (nullptr)
-{
-}
-
-LogFile::~LogFile ()
-{
-}
-
-bool LogFile::isOpen () const noexcept
-{
- return m_stream != nullptr;
-}
-
-bool LogFile::open (boost::filesystem::path const& path)
-{
- close ();
-
- bool wasOpened = false;
-
- // VFALCO TODO Make this work with Unicode file paths
- std::unique_ptr stream (
- new std::ofstream (path.c_str (), std::fstream::app));
-
- if (stream->good ())
- {
- m_path = path;
-
- m_stream = std::move (stream);
-
- wasOpened = true;
- }
-
- return wasOpened;
-}
-
-bool LogFile::closeAndReopen ()
-{
- close ();
-
- return open (m_path);
-}
-
-void LogFile::close ()
-{
- m_stream = nullptr;
-}
-
-void LogFile::write (char const* text)
-{
- if (m_stream != nullptr)
- (*m_stream) << text;
-}
-
-void LogFile::writeln (char const* text)
-{
- if (m_stream != nullptr)
- {
- (*m_stream) << text;
- (*m_stream) << std::endl;
- }
-}
-
-} // ripple
diff --git a/src/ripple/basics/log/LogFile.h b/src/ripple/basics/log/LogFile.h
deleted file mode 100644
index 06865028d..000000000
--- a/src/ripple/basics/log/LogFile.h
+++ /dev/null
@@ -1,113 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef RIPPLE_BASICS_LOGFILE_H_INCLUDED
-#define RIPPLE_BASICS_LOGFILE_H_INCLUDED
-
-#include
-#include
-
-namespace ripple {
-
-/** Manages a system file containing logged output.
-
- The system file remains open during program execution. Interfaces
- are provided for interoperating with standard log management
- tools like logrotate(8):
-
- http://linuxcommand.org/man_pages/logrotate8.html
-
- @note None of the listed interfaces are thread-safe.
-*/
-class LogFile
-{
-public:
- /** Construct with no associated system file.
-
- A system file may be associated later with @ref open.
-
- @see open
- */
- LogFile ();
-
- /** Destroy the object.
-
- If a system file is associated, it will be flushed and closed.
- */
- ~LogFile ();
-
- /** Determine if a system file is associated with the log.
-
- @return `true` if a system file is associated and opened for writing.
- */
- bool isOpen () const noexcept;
-
- /** Associate a system file with the log.
-
- If the file does not exist an attempt is made to create it
- and open it for writing. If the file already exists an attempt is
- made to open it for appending.
-
- If a system file is already associated with the log, it is closed first.
-
- @return `true` if the file was opened.
- */
- // VFALCO NOTE The parameter is unfortunately a boost type because it
- // can be either wchar or char based depending on platform.
- // TODO Replace with beast::File
- //
- bool open (boost::filesystem::path const& path);
-
- /** Close and re-open the system file associated with the log
-
- This assists in interoperating with external log management tools.
-
- @return `true` if the file was opened.
- */
- bool closeAndReopen ();
-
- /** Close the system file if it is open.
- */
- void close ();
-
- /** write to the log file.
-
- Does nothing if there is no associated system file.
- */
- void write (char const* text);
-
- /** write to the log file and append an end of line marker.
-
- Does nothing if there is no associated system file.
- */
- void writeln (char const* text);
-
- /** Write to the log file using std::string.
- */
- inline void write (std::string const& str) { write (str.c_str ()); }
- inline void writeln (std::string const& str) { writeln (str.c_str ()); }
-
-private:
- std::unique_ptr m_stream;
- boost::filesystem::path m_path;
-};
-
-} // ripple
-
-#endif
diff --git a/src/ripple/basics/log/LogPartition.cpp b/src/ripple/basics/log/LogPartition.cpp
deleted file mode 100644
index 718a51e4a..000000000
--- a/src/ripple/basics/log/LogPartition.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#include
-
-namespace ripple {
-
-void LogPartition::write (beast::Journal::Severity level, std::string const& text)
-{
- std::string output;
- LogSeverity const logSeverity (convertSeverity (level));
- LogSink::get()->format (output, text, logSeverity, mName);
- LogSink::get()->write (output, logSeverity);
- if (console ())
- LogSink::get()->write_console (output);
-}
-
-//------------------------------------------------------------------------------
-
-LogPartition::LogPartition (std::string const& name)
- : mNextLog (headLog)
- , mName (canonicalFileName (name.c_str()))
-{
- severity (beast::Journal::kWarning);
- // VFALCO TODO Use an intrusive list.
- headLog = this;
-}
-
-bool LogPartition::doLog (LogSeverity s) const
-{
- return s >= getSeverity();
-}
-
-std::string const& LogPartition::getName () const
-{
- return mName;
-}
-
-LogSeverity LogPartition::getSeverity() const
-{
- return convertSeverity (severity ());
-}
-
-void LogPartition::setMinimumSeverity (LogSeverity level)
-{
- severity (convertLogSeverity (level));
-}
-
-//------------------------------------------------------------------------------
-
-LogPartition* LogPartition::headLog = nullptr;
-
-std::string LogPartition::canonicalFileName (char const* fileName)
-{
- std::string result;
- char const* ptr (strrchr (fileName, '/'));
- result = (ptr == nullptr) ? fileName : (ptr + 1);
-
- size_t p = result.find (".cpp");
-
- if (p != std::string::npos)
- result.erase (result.begin () + p, result.end ());
-
- return result;
-}
-
-LogPartition* LogPartition::find (std::string const& name)
-{
- for (LogPartition* p = headLog; p != nullptr; p = p->mNextLog)
- if (boost::iequals (p->getName(), name))
- return p;
- return nullptr;
-}
-
-void LogPartition::setSeverity (LogSeverity level)
-{
- for (LogPartition* p = headLog; p != nullptr; p = p->mNextLog)
- p->setMinimumSeverity (level);
-}
-
-bool LogPartition::setSeverity (const std::string& partition, LogSeverity level)
-{
- LogPartition* const p (find (partition));
-
- if (p)
- {
- p->setMinimumSeverity (level);
- return true;
- }
-
- return false;
-}
-
-void LogPartition::setConsoleOutput (std::string const& list)
-{
- std::string::const_iterator first (list.begin());
- for(;;)
- {
- std::string::const_iterator last (std::find (
- first, list.end(), ','));
-
- LogPartition* const p (find (std::string (first, last)));
- if (p != nullptr)
- p->console (true);
-
- if (last != list.end())
- first = last + 1;
- else
- break;
- }
-}
-
-LogPartition::Severities LogPartition::getSeverities ()
-{
- LogPartition::Severities result;
-
- for (LogPartition* l = headLog; l != nullptr; l = l->mNextLog)
- result.push_back (std::make_pair (
- l->mName, Log::severityToString (l->getSeverity ())));
-
- return result;
-}
-
-//------------------------------------------------------------------------------
-
-LogSeverity LogPartition::convertSeverity (beast::Journal::Severity level)
-{
- using beast::Journal;
- switch (level)
- {
- case Journal::kTrace: return lsTRACE;
- case Journal::kDebug: return lsDEBUG;
- case Journal::kInfo: return lsINFO;
- case Journal::kWarning: return lsWARNING;
- case Journal::kError: return lsERROR;
-
- default:
- bassertfalse;
- case Journal::kFatal:
- break;
- }
-
- return lsFATAL;
-}
-
-beast::Journal::Severity LogPartition::convertLogSeverity (LogSeverity level)
-{
- using beast::Journal;
- switch (level)
- {
- case lsTRACE: return Journal::kTrace;
- case lsDEBUG: return Journal::kDebug;
- case lsINFO: return Journal::kInfo;
- case lsWARNING: return Journal::kWarning;
- case lsERROR: return Journal::kError;
- default:
- bassertfalse;
- case lsFATAL:
- break;
- }
-
- return Journal::kFatal;
-}
-
-} // ripple
diff --git a/src/ripple/basics/log/LogPartition.h b/src/ripple/basics/log/LogPartition.h
deleted file mode 100644
index ac7bf4ce3..000000000
--- a/src/ripple/basics/log/LogPartition.h
+++ /dev/null
@@ -1,147 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef RIPPLE_BASICS_LOGPARTITION_H_INCLUDED
-#define RIPPLE_BASICS_LOGPARTITION_H_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-
-namespace ripple {
-
-class LogPartition : public beast::Journal::Sink
-{
-public:
- //--------------------------------------------------------------------------
- //
- // Journal::Sink
- //
- //--------------------------------------------------------------------------
-
- void write (beast::Journal::Severity level, std::string const& text);
-
- //--------------------------------------------------------------------------
-
- /** Construct the partition with the specified name. */
- explicit LogPartition (std::string const& name);
-
- /** Returns `true` output is produced at the given severity. */
- bool doLog (LogSeverity s) const;
-
- /** Returns the name of this partition. */
- std::string const& getName () const;
-
- /** Return the lowest severity reported on the partition. */
- LogSeverity getSeverity() const;
-
- /** Sets the lowest severity reported on the partition. */
- void setMinimumSeverity (LogSeverity severity);
-
- //--------------------------------------------------------------------------
-
- /** Returns the LogPartition based on a type key. */
- template
- static LogPartition& get ();
-
- /** Returns a Journal using the specified LogPartition type key. */
- template
- static beast::Journal getJournal ()
- {
- return beast::Journal (get ());
- }
-
- /** Returns a cleaned up source code file name. */
- static std::string canonicalFileName (char const* fileName);
-
- /** Returns the partition with the given name or nullptr if no match. */
- static LogPartition* find (std::string const& name);
-
- /** Set the minimum severity of all existing partitions at once. */
- static void setSeverity (LogSeverity severity);
-
- /** Set the minimum severity of a partition by name. */
- static bool setSeverity (std::string const& name, LogSeverity severity);
-
- /** Activate console output for the specified comma-separated partition list. */
- static void setConsoleOutput (std::string const& list);
-
- /** Returns a list of all partitions and their severity levels. */
- typedef std::vector > Severities;
- static Severities getSeverities ();
-
- /** Convert the Journal::Severity to and from a LogSeverity. */
- /** @{ */
- static LogSeverity convertSeverity (beast::Journal::Severity level);
- static beast::Journal::Severity convertLogSeverity (LogSeverity level);
- /** @} */
-
- /** Retrieve the name for a log partition. */
- template
- static char const* getPartitionName ();
-
-private:
- // VFALCO TODO Use an intrusive linked list
- //
- static LogPartition* headLog;
-
- LogPartition* mNextLog;
- std::string mName;
-};
-
-//------------------------------------------------------------------------------
-
-namespace detail {
-
-template
-struct LogPartitionType : LogPartition
-{
- LogPartitionType () : LogPartition (getPartitionName ())
- { }
-};
-
-}
-
-template
-LogPartition& LogPartition::get ()
-{
- return *beast::SharedSingleton <
- detail::LogPartitionType >::getInstance();
-}
-
-//------------------------------------------------------------------------------
-
-// VFALCO These macros are deprecated. Use the Journal class instead.
-
-#define SETUP_LOG(Class) \
- template <> char const* LogPartition::getPartitionName () { return #Class; } \
- struct Class##Instantiator { Class##Instantiator () { LogPartition::get (); } }; \
- static Class##Instantiator Class##Instantiator_instance;
-
-#define SETUP_LOGN(Class,Name) \
- template <> char const* LogPartition::getPartitionName () { return Name; } \
- struct Class##Instantiator { Class##Instantiator () { LogPartition::get (); } }; \
- static Class##Instantiator Class##Instantiator_instance;
-
-} // ripple
-
-#endif
-
diff --git a/src/ripple/basics/log/LogSeverity.h b/src/ripple/basics/log/LogSeverity.h
deleted file mode 100644
index 7cc1440ee..000000000
--- a/src/ripple/basics/log/LogSeverity.h
+++ /dev/null
@@ -1,38 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef RIPPLE_BASICS_LOGSEVERITY_H_INCLUDED
-#define RIPPLE_BASICS_LOGSEVERITY_H_INCLUDED
-
-namespace ripple {
-
-enum LogSeverity
-{
- lsINVALID = -1, // used to indicate an invalid severity
- lsTRACE = 0, // Very low-level progress information, details inside an operation
- lsDEBUG = 1, // Function-level progress information, operations
- lsINFO = 2, // Server-level progress information, major operations
- lsWARNING = 3, // Conditions that warrant human attention, may indicate a problem
- lsERROR = 4, // A condition that indicates a problem
- lsFATAL = 5 // A severe condition that indicates a server problem
-};
-
-} // ripple
-
-#endif
diff --git a/src/ripple/basics/log/LogSink.cpp b/src/ripple/basics/log/LogSink.cpp
deleted file mode 100644
index 83f21fa6c..000000000
--- a/src/ripple/basics/log/LogSink.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#include
-#include
-
-namespace ripple {
-
-LogSink::LogSink ()
- : m_minSeverity (lsINFO)
-{
-}
-
-LogSink::~LogSink ()
-{
-}
-
-LogSeverity LogSink::getMinSeverity ()
-{
- ScopedLockType lock (m_mutex);
-
- return m_minSeverity;
-}
-
-void LogSink::setMinSeverity (LogSeverity s, bool all)
-{
- ScopedLockType lock (m_mutex);
-
- m_minSeverity = s;
-
- if (all)
- LogPartition::setSeverity (s);
-}
-
-void LogSink::setLogFile (boost::filesystem::path const& path)
-{
- bool const wasOpened = m_logFile.open (path.c_str ());
-
- if (! wasOpened)
- {
- Log (lsFATAL) << "Unable to open logfile " << path;
- }
-}
-
-std::string LogSink::rotateLog ()
-{
- ScopedLockType lock (m_mutex);
-
- bool const wasOpened = m_logFile.closeAndReopen ();
-
- if (wasOpened)
- {
- return "The log file was closed and reopened.";
- }
- else
- {
- return "The log file could not be closed and reopened.";
- }
-}
-
-void LogSink::format (
- std::string& output,
- std::string const& message,
- LogSeverity severity,
- std::string const& partitionName)
-{
- output.reserve (message.size() + partitionName.size() + 100);
-
- output = boost::posix_time::to_simple_string (
- boost::posix_time::second_clock::universal_time ());
-
- output += " ";
- if (! partitionName.empty ())
- output += partitionName + ":";
-
- switch (severity)
- {
- case lsTRACE: output += "TRC "; break;
- case lsDEBUG: output += "DBG "; break;
- case lsINFO: output += "NFO "; break;
- case lsWARNING: output += "WRN "; break;
- case lsERROR: output += "ERR "; break;
- default:
- bassertfalse;
- case lsFATAL: output += "FTL ";
- break;
- }
-
- output += replaceFirstSecretWithAsterisks (message);
-
- if (output.size() > maximumMessageCharacters)
- {
- output.resize (maximumMessageCharacters - 3);
- output += "...";
- }
-}
-
-void LogSink::write (
- std::string const& message,
- LogSeverity severity,
- std::string const& partitionName)
-{
- std::string output;
-
- format (output, message, severity, partitionName);
-
- write (output, severity);
-}
-
-void LogSink::write (std::string const& output, LogSeverity severity)
-{
- ScopedLockType lock (m_mutex);
- write (output, severity >= getMinSeverity(), lock);
-}
-
-void LogSink::write (std::string const& text)
-{
- ScopedLockType lock (m_mutex);
- write (text, true, lock);
-}
-
-void LogSink::write (std::string const& line, bool toStdErr, ScopedLockType&)
-{
- // Does nothing if not open.
- m_logFile.writeln (line);
-
- if (toStdErr)
- std::cerr << line << std::endl;
-}
-
-void LogSink::write_console (std::string const& text)
-{
-#if BEAST_MSVC
- if (beast::beast_isRunningUnderDebugger ())
- beast::Logger::outputDebugString (text.c_str());
-#endif
-}
-
-//------------------------------------------------------------------------------
-
-std::string LogSink::replaceFirstSecretWithAsterisks (std::string s)
-{
- using namespace std;
-
- char const* secretToken = "\"secret\"";
-
- // Look for the first occurrence of "secret" in the string.
- //
- size_t startingPosition = s.find (secretToken);
-
- if (startingPosition != string::npos)
- {
- // Found it, advance past the token.
- //
- startingPosition += strlen (secretToken);
-
- // Replace the next 35 characters at most, without overwriting the end.
- //
- size_t endingPosition = std::min (startingPosition + 35, s.size () - 1);
-
- for (size_t i = startingPosition; i < endingPosition; ++i)
- s [i] = '*';
- }
-
- return s;
-}
-
-//------------------------------------------------------------------------------
-
-LogSink::Ptr LogSink::get ()
-{
- return beast::SharedSingleton ::getInstance ();
-}
-
-} // ripple
diff --git a/src/ripple/basics/log/LogSink.h b/src/ripple/basics/log/LogSink.h
deleted file mode 100644
index 9cd172459..000000000
--- a/src/ripple/basics/log/LogSink.h
+++ /dev/null
@@ -1,108 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of rippled: https://github.com/ripple/rippled
- Copyright (c) 2012, 2013 Ripple Labs Inc.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef RIPPLE_BASICS_LOGSINK_H_INCLUDED
-#define RIPPLE_BASICS_LOGSINK_H_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-
-namespace ripple {
-
-/** An endpoint for all logging messages. */
-class LogSink
-{
-public:
- LogSink ();
- ~LogSink ();
-
- /** Returns the minimum severity required for also writing to stderr. */
- LogSeverity getMinSeverity ();
-
- /** Sets the minimum severity required for also writing to stderr.
- If 'all' is true this will set the minimum reporting severity for
- all partitions.
- */
- void setMinSeverity (LogSeverity, bool all);
-
- /** Sets the path to the log file. */
- void setLogFile (boost::filesystem::path const& pathToLogFile);
-
- /** Rotate the log file.
- The log file is closed and reopened. This is for compatibility
- with log management tools.
- @return A human readable string describing the result of the operation.
- */
- std::string rotateLog ();
-
- /** Format a log message. */
- void format (std::string& output,
- std::string const& message, LogSeverity severity,
- std::string const& partitionName);
-
- /** Write to log output.
- All logging eventually goes through these functios.
- The text should not contain a final newline, it will be automatically
- added as needed.
-
- @note This acquires a global mutex.
-
- @param text The text to write.
- @param toStdErr `true` to also write to std::cerr
- */
- /** @{ */
- void write (std::string const& message, LogSeverity severity, std::string const& partitionName);
- void write (std::string const& text, LogSeverity severity);
- void write (std::string const& text);
- void write_console (std::string const& text);
- /** @} */
-
- /** Hides secret keys from log output. */
- static std::string replaceFirstSecretWithAsterisks (std::string s);
-
- /** Returns a pointer to the singleton. */
- typedef beast::SharedPtr > Ptr;
- static Ptr get ();
-
-private:
- typedef std::recursive_mutex LockType;
- typedef std::lock_guard ScopedLockType;
-
- enum
- {
- /** Maximum line length for log messages.
- If the message exceeds this length it will be truncated with elipses.
- */
- maximumMessageCharacters = 12 * 1024
- };
-
- void write (std::string const& line, bool toStdErr, ScopedLockType&);
-
- LockType m_mutex;
-
- LogFile m_logFile;
- LogSeverity m_minSeverity;
-};
-
-} // ripple
-
-#endif
diff --git a/src/ripple/basics/log/LoggedTimings.h b/src/ripple/basics/log/LoggedTimings.h
index 5747c9da9..932bb251d 100644
--- a/src/ripple/basics/log/LoggedTimings.h
+++ b/src/ripple/basics/log/LoggedTimings.h
@@ -105,9 +105,7 @@ void logTimedDestroy (
if (seconds > thresholdSeconds)
{
- LogSeverity const severity = lsWARNING;
-
- Log (severity, LogPartition::get ()) <<
+ deprecatedLogs().journal("LoggedTimings").warning <<
objectDescription << " took "<<
beast::String (detail::cleanElapsed (seconds)) <<
" seconds to destroy";
diff --git a/src/ripple/basics/utility/IniFile.cpp b/src/ripple/basics/utility/IniFile.cpp
index 48df59cfe..6a5785a4c 100644
--- a/src/ripple/basics/utility/IniFile.cpp
+++ b/src/ripple/basics/utility/IniFile.cpp
@@ -25,10 +25,6 @@ namespace ripple {
#define SECTION_DEFAULT_NAME ""
-struct ParseSectionLog; // for Log
-
-SETUP_LOGN (ParseSectionLog,"ParseSection")
-
Section ParseSection (const std::string& strInput, const bool bTrim)
{
std::string strData (strInput);
@@ -77,27 +73,6 @@ Section ParseSection (const std::string& strInput, const bool bTrim)
return secResult;
}
-void SectionEntriesPrint (std::vector* vspEntries, const std::string& strSection)
-{
- Log::out() << "[" << strSection << "]";
-
- if (vspEntries)
- {
- BOOST_FOREACH (std::string & strValue, *vspEntries)
- {
- Log::out() << strValue;
- }
- }
-}
-
-void SectionPrint (Section secInput)
-{
- BOOST_FOREACH (Section::value_type & pairSection, secInput)
- {
- SectionEntriesPrint (&pairSection.second, pairSection.first);
- }
-}
-
Section::mapped_type* SectionEntries (Section& secSource, const std::string& strSection)
{
Section::iterator it;
@@ -137,7 +112,7 @@ bool SectionSingleB (Section& secSource, const std::string& strSection, std::str
}
else if (pmtEntries)
{
- WriteLog (lsWARNING, ParseSectionLog) << boost::str (boost::format ("Section [%s]: requires 1 line not %d lines.")
+ WriteLog (lsWARNING, ParseSection) << boost::str (boost::format ("Section [%s]: requires 1 line not %d lines.")
% strSection
% pmtEntries->size ());
}
diff --git a/src/ripple/basics/utility/IniFile.h b/src/ripple/basics/utility/IniFile.h
index 2c5a1e95e..b69007c86 100644
--- a/src/ripple/basics/utility/IniFile.h
+++ b/src/ripple/basics/utility/IniFile.h
@@ -31,8 +31,6 @@ typedef std::map > Section;
//
Section ParseSection (const std::string& strInput, const bool bTrim);
-void SectionPrint (Section secInput);
-void SectionEntriesPrint (std::vector* vspEntries, const std::string& strSection);
bool SectionSingleB (Section& secSource, const std::string& strSection, std::string& strValue);
int SectionCount (Section& secSource, const std::string& strSection);
Section::mapped_type* SectionEntries (Section& secSource, const std::string& strSection);
diff --git a/src/ripple/basics/utility/StringUtilities.cpp b/src/ripple/basics/utility/StringUtilities.cpp
index acaea7cdc..164183511 100644
--- a/src/ripple/basics/utility/StringUtilities.cpp
+++ b/src/ripple/basics/utility/StringUtilities.cpp
@@ -257,11 +257,8 @@ bool parseUrl (const std::string& strUrl, std::string& strScheme, std::string& s
boost::algorithm::to_lower (strScheme);
iPort = strPort.empty () ? -1 : beast::lexicalCast (strPort);
- // Log::out() << strUrl << " : " << bMatch << " : '" << strDomain << "' : '" << strPort << "' : " << iPort << " : '" << strPath << "'";
}
- // Log::out() << strUrl << " : " << bMatch << " : '" << strDomain << "' : '" << strPath << "'";
-
return bMatch;
}
diff --git a/src/ripple/module/app/consensus/LedgerConsensus.cpp b/src/ripple/module/app/consensus/LedgerConsensus.cpp
index c57445d3e..cbf315c07 100644
--- a/src/ripple/module/app/consensus/LedgerConsensus.cpp
+++ b/src/ripple/module/app/consensus/LedgerConsensus.cpp
@@ -21,10 +21,6 @@
namespace ripple {
-SETUP_LOG (LedgerConsensus)
-
-// #define TRUST_NETWORK
-
class LedgerConsensusImp
: public LedgerConsensus
, public std::enable_shared_from_this
diff --git a/src/ripple/module/app/data/SqliteDatabase.cpp b/src/ripple/module/app/data/SqliteDatabase.cpp
index ae56f10d2..621376c27 100644
--- a/src/ripple/module/app/data/SqliteDatabase.cpp
+++ b/src/ripple/module/app/data/SqliteDatabase.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (SqliteDatabase)
-
SqliteStatement::SqliteStatement (SqliteDatabase* db, const char* sql, bool aux)
{
assert (db);
diff --git a/src/ripple/module/app/ledger/AcceptedLedger.cpp b/src/ripple/module/app/ledger/AcceptedLedger.cpp
index 82792b2d7..201d96d7e 100644
--- a/src/ripple/module/app/ledger/AcceptedLedger.cpp
+++ b/src/ripple/module/app/ledger/AcceptedLedger.cpp
@@ -24,7 +24,7 @@ namespace ripple {
//
TaggedCache AcceptedLedger::s_cache (
"AcceptedLedger", 4, 60, get_seconds_clock (),
- LogPartition::getJournal ());
+ deprecatedLogs().journal("TaggedCache"));
AcceptedLedger::AcceptedLedger (Ledger::ref ledger) : mLedger (ledger)
{
diff --git a/src/ripple/module/app/ledger/InboundLedger.cpp b/src/ripple/module/app/ledger/InboundLedger.cpp
index a0ec166f3..0d4f4f248 100644
--- a/src/ripple/module/app/ledger/InboundLedger.cpp
+++ b/src/ripple/module/app/ledger/InboundLedger.cpp
@@ -22,9 +22,6 @@
namespace ripple {
-//SETUP_LOG (InboundLedger)
-template <> char const* LogPartition::getPartitionName () { return "InLedger"; }
-
enum
{
// millisecond for each ledger timeout
@@ -40,7 +37,7 @@ enum
InboundLedger::InboundLedger (uint256 const& hash, std::uint32_t seq, fcReason reason,
clock_type& clock)
: PeerSet (hash, ledgerAcquireTimeoutMillis, false, clock,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("InboundLedger"))
, mHaveBase (false)
, mHaveState (false)
, mHaveTransactions (false)
diff --git a/src/ripple/module/app/ledger/Ledger.cpp b/src/ripple/module/app/ledger/Ledger.cpp
index f5026a08c..975b9dfed 100644
--- a/src/ripple/module/app/ledger/Ledger.cpp
+++ b/src/ripple/module/app/ledger/Ledger.cpp
@@ -24,8 +24,6 @@
namespace ripple {
-SETUP_LOG (Ledger)
-
LedgerBase::LedgerBase ()
{
}
@@ -357,10 +355,6 @@ bool Ledger::addSLE (SLE const& sle)
AccountState::pointer Ledger::getAccountState (const RippleAddress& accountID)
{
-#ifdef BEAST_DEBUG
- // Log::out() << "Ledger:getAccountState(" << accountID.humanAccountID() << ")";
-#endif
-
SLE::pointer sle = getSLEi (Ledger::getAccountRootIndex (accountID));
if (!sle)
@@ -861,10 +855,10 @@ Ledger::pointer Ledger::getSQL (const std::string& sql)
{
if (ShouldLog (lsERROR, Ledger))
{
- Log (lsERROR) << "Failed on ledger";
+ WriteLog (lsERROR, Ledger) << "Failed on ledger";
Json::Value p;
ret->addJson (p, LEDGER_JSON_FULL);
- Log (lsERROR) << p;
+ WriteLog (lsERROR, Ledger) << p;
}
assert (false);
@@ -1204,7 +1198,7 @@ LedgerStateParms Ledger::writeBack (LedgerStateParms parms, SLE::ref entry)
{
if ((parms & lepCREATE) == 0)
{
- Log (lsERROR) << "WriteBack non-existent node without create";
+ WriteLog (lsERROR, Ledger) << "WriteBack non-existent node without create";
return lepMISSING;
}
@@ -1827,16 +1821,16 @@ bool Ledger::walkLedger ()
if (ShouldLog (lsINFO, Ledger) && !missingNodes1.empty ())
{
- Log (lsINFO) << missingNodes1.size () << " missing account node(s)";
- Log (lsINFO) << "First: " << missingNodes1[0];
+ WriteLog (lsINFO, Ledger) << missingNodes1.size () << " missing account node(s)";
+ WriteLog (lsINFO, Ledger) << "First: " << missingNodes1[0];
}
mTransactionMap->walkMap (missingNodes2, 32);
if (ShouldLog (lsINFO, Ledger) && !missingNodes2.empty ())
{
- Log (lsINFO) << missingNodes2.size () << " missing transaction node(s)";
- Log (lsINFO) << "First: " << missingNodes2[0];
+ WriteLog (lsINFO, Ledger) << missingNodes2.size () << " missing transaction node(s)";
+ WriteLog (lsINFO, Ledger) << "First: " << missingNodes2[0];
}
return missingNodes1.empty () && missingNodes2.empty ();
@@ -1854,7 +1848,7 @@ bool Ledger::assertSane ()
return true;
}
- Log (lsFATAL) << "ledger is not sane";
+ WriteLog (lsFATAL, Ledger) << "ledger is not sane";
Json::Value j = getJson (0);
diff --git a/src/ripple/module/app/ledger/LedgerEntrySet.cpp b/src/ripple/module/app/ledger/LedgerEntrySet.cpp
index 1c618c53f..2c1c5feba 100644
--- a/src/ripple/module/app/ledger/LedgerEntrySet.cpp
+++ b/src/ripple/module/app/ledger/LedgerEntrySet.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (LedgerEntrySet)
-
// #define META_DEBUG
// VFALCO TODO Replace this macro with a documented language constant
diff --git a/src/ripple/module/app/ledger/LedgerHistory.cpp b/src/ripple/module/app/ledger/LedgerHistory.cpp
index 847948fbd..cbf8d8947 100644
--- a/src/ripple/module/app/ledger/LedgerHistory.cpp
+++ b/src/ripple/module/app/ledger/LedgerHistory.cpp
@@ -33,9 +33,9 @@ namespace ripple {
LedgerHistory::LedgerHistory ()
: m_ledgers_by_hash ("LedgerCache", CACHED_LEDGER_NUM, CACHED_LEDGER_AGE,
- get_seconds_clock (), LogPartition::getJournal ())
+ get_seconds_clock (), deprecatedLogs().journal("TaggedCache"))
, m_consensus_validated ("ConsensusValidated", 64, 300,
- get_seconds_clock (), LogPartition::getJournal ())
+ get_seconds_clock (), deprecatedLogs().journal("TaggedCache"))
{
}
diff --git a/src/ripple/module/app/ledger/LedgerMaster.cpp b/src/ripple/module/app/ledger/LedgerMaster.cpp
index b7d9a0c66..5834a3e84 100644
--- a/src/ripple/module/app/ledger/LedgerMaster.cpp
+++ b/src/ripple/module/app/ledger/LedgerMaster.cpp
@@ -25,11 +25,6 @@ namespace ripple {
#define MIN_VALIDATION_RATIO 150 // 150/256ths of validations of previous ledger
#define MAX_LEDGER_GAP 100 // Don't catch up more than 100 ledgers (cannot exceed 256)
-SETUP_LOG (LedgerMaster)
-
-class LedgerCleanerLog;
-template <> char const* LogPartition::getPartitionName () { return "LedgerCleaner"; }
-
class LedgerMasterImp
: public LedgerMaster
, public beast::LeakChecked
@@ -85,7 +80,7 @@ public:
: LedgerMaster (parent)
, m_journal (journal)
, mHeldTransactions (uint256 ())
- , mLedgerCleaner (LedgerCleaner::New(*this, LogPartition::getJournal()))
+ , mLedgerCleaner (LedgerCleaner::New(*this, deprecatedLogs().journal("LedgerCleaner")))
, mMinValidations (0)
, mLastValidateSeq (0)
, mAdvanceThread (false)
diff --git a/src/ripple/module/app/ledger/LedgerTiming.cpp b/src/ripple/module/app/ledger/LedgerTiming.cpp
index 2feb98e34..6380ef72f 100644
--- a/src/ripple/module/app/ledger/LedgerTiming.cpp
+++ b/src/ripple/module/app/ledger/LedgerTiming.cpp
@@ -21,10 +21,6 @@ namespace ripple {
// VFALCO Should rename ContinuousLedgerTiming to LedgerTiming
-struct LedgerTiming; // for Log
-
-SETUP_LOG (LedgerTiming)
-
// NOTE: First and last times must be repeated
int ContinuousLedgerTiming::LedgerTimeResolution[] = { 10, 10, 20, 30, 60, 90, 120, 120 };
diff --git a/src/ripple/module/app/ledger/OrderBookDB.cpp b/src/ripple/module/app/ledger/OrderBookDB.cpp
index 9b1a30ac2..c25ee4ef6 100644
--- a/src/ripple/module/app/ledger/OrderBookDB.cpp
+++ b/src/ripple/module/app/ledger/OrderBookDB.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (OrderBookDB)
-
OrderBookDB::OrderBookDB (Stoppable& parent)
: Stoppable ("OrderBookDB", parent)
, mSeq (0)
diff --git a/src/ripple/module/app/ledger/SerializedValidation.cpp b/src/ripple/module/app/ledger/SerializedValidation.cpp
index 99eb39710..252e8ae11 100644
--- a/src/ripple/module/app/ledger/SerializedValidation.cpp
+++ b/src/ripple/module/app/ledger/SerializedValidation.cpp
@@ -28,7 +28,7 @@ SerializedValidation::SerializedValidation (SerializerIterator& sit, bool checkS
if (checkSignature && !isValid ())
{
- Log (lsTRACE) << "Invalid validation " << getJson (0);
+ WriteLog (lsTRACE, Ledger) << "Invalid validation " << getJson (0);
throw std::runtime_error ("Invalid validation");
}
}
@@ -104,7 +104,7 @@ bool SerializedValidation::isValid (uint256 const& signingHash) const
}
catch (...)
{
- Log (lsINFO) << "exception validating validation";
+ WriteLog (lsINFO, Ledger) << "exception validating validation";
return false;
}
}
diff --git a/src/ripple/module/app/main/Application.cpp b/src/ripple/module/app/main/Application.cpp
index 88ea27afa..e7d03c170 100644
--- a/src/ripple/module/app/main/Application.cpp
+++ b/src/ripple/module/app/main/Application.cpp
@@ -17,10 +17,9 @@
*/
//==============================================================================
-#include
-
#include
#include
+#include
#include
#include
#include
@@ -30,8 +29,6 @@
#include
#include
#include
-#include
-#include
#include
namespace ripple {
@@ -41,46 +38,6 @@ static bool volatile doShutdown = false;
static int const MAJORITY_FRACTION (204);
-//------------------------------------------------------------------------------
-//
-// Specializations for LogPartition names
-
-// VFALCO NOTE This is temporary, until I refactor LogPartition
-// and LogPartition::getJournal() to take a string
-//
-class ApplicationLog;
-template <> char const* LogPartition::getPartitionName () { return "Application"; }
-class SiteFilesLog;
-template <> char const* LogPartition::getPartitionName () { return "SiteFiles"; }
-class ValidatorsLog;
-template <> char const* LogPartition::getPartitionName () { return "Validators"; }
-class JobQueueLog;
-template <> char const* LogPartition::getPartitionName () { return "JobQueue"; }
-class NetworkOPsLog;
-template <> char const* LogPartition::getPartitionName () { return "NetworkOPs"; }
-class RPCServiceManagerLog;
-template <> char const* LogPartition::getPartitionName () { return "RPCServiceManager"; }
-class HTTPServerLog;
-template <> char const* LogPartition::getPartitionName () { return "RPCServer"; }
-class LoadManagerLog;
-template <> char const* LogPartition::getPartitionName () { return "LoadManager"; }
-class ResourceManagerLog;
-template <> char const* LogPartition::getPartitionName () { return "ResourceManager"; }
-class PathRequestLog;
-template <> char const* LogPartition::getPartitionName () { return "PathRequest"; }
-class RPCManagerLog;
-template <> char const* LogPartition::getPartitionName () { return "RPCManager"; }
-class AmendmentTableLog;
-template <> char const* LogPartition::getPartitionName () { return "AmendmentTable"; }
-
-template <> char const* LogPartition::getPartitionName () { return "Collector"; }
-
-struct TaggedCacheLog;
-template <> char const* LogPartition::getPartitionName () { return "TaggedCache"; }
-
-//
-//------------------------------------------------------------------------------
-
// This hack lets the s_instance variable remain set during
// the call to ~Application
class ApplicationImpBase : public Application
@@ -182,6 +139,7 @@ private:
};
public:
+ Logs& m_logs;
beast::Journal m_journal;
Application::LockType m_masterMutex;
@@ -260,26 +218,26 @@ public:
//--------------------------------------------------------------------------
- ApplicationImp ()
+ ApplicationImp (Logs& logs)
: RootStoppable ("Application")
- , m_journal (LogPartition::getJournal ())
+ , m_logs (logs)
+
+ , m_journal (m_logs.journal("Application"))
, m_nodeStoreManager (NodeStore::make_Manager (
std::move (make_Factories ())))
, m_tempNodeCache ("NodeCache", 16384, 90, get_seconds_clock (),
- LogPartition::getJournal ())
+ m_logs.journal("TaggedCache"))
, m_sleCache ("LedgerEntryCache", 4096, 120, get_seconds_clock (),
- LogPartition::getJournal ())
+ m_logs.journal("TaggedCache"))
, m_collectorManager (CollectorManager::New (
- getConfig().insightSettings,
- LogPartition::getJournal ()))
+ getConfig().insightSettings, m_logs.journal("Collector")))
, m_resourceManager (Resource::make_Manager (
- m_collectorManager->collector(),
- LogPartition::getJournal ()))
+ m_collectorManager->collector(), m_logs.journal("Resource")))
, m_fullBelowCache (std::make_unique (
"full_below", get_seconds_clock (), m_collectorManager->collector (),
@@ -291,7 +249,7 @@ public:
// almost everything is a Stoppable child of the JobQueue.
//
, m_jobQueue (make_JobQueue (m_collectorManager->group ("jobq"),
- m_nodeStoreScheduler, LogPartition::getJournal ()))
+ m_nodeStoreScheduler, m_logs.journal("JobQueue")))
// The io_service must be a child of the JobQueue since we call addJob
// in response to newtwork data from peers and also client requests.
@@ -303,17 +261,17 @@ public:
//
, m_siteFiles (SiteFiles::Manager::New (
- *this, LogPartition::getJournal ()))
+ *this, m_logs.journal("SiteFiles")))
- , m_rpcManager (RPC::make_Manager (LogPartition::getJournal ()))
+ , m_rpcManager (RPC::make_Manager (m_logs.journal("RPCManager")))
, m_orderBookDB (*m_jobQueue)
- , m_pathRequests ( new PathRequests (
- LogPartition::getJournal (), m_collectorManager->collector ()))
+ , m_pathRequests (new PathRequests (
+ m_logs.journal("PathRequest"), m_collectorManager->collector ()))
, m_ledgerMaster (LedgerMaster::New (
- *m_jobQueue, LogPartition::getJournal ()))
+ *m_jobQueue, m_logs.journal("LedgerMaster")))
// VFALCO NOTE must come before NetworkOPs to prevent a crash due
// to dependencies in the destructor.
@@ -323,18 +281,18 @@ public:
// VFALCO NOTE Does NetworkOPs depend on LedgerMaster?
, m_networkOPs (NetworkOPs::New (get_seconds_clock (), *m_ledgerMaster,
- *m_jobQueue, LogPartition::getJournal ()))
+ *m_jobQueue, m_logs.journal("NetworkOPs")))
// VFALCO NOTE LocalCredentials starts the deprecated UNL service
, m_deprecatedUNL (UniqueNodeList::New (*m_jobQueue))
, m_rpcHTTPServer (RPCHTTPServer::New (*m_networkOPs,
- LogPartition::getJournal (), *m_jobQueue, *m_networkOPs, *m_resourceManager))
+ m_logs.journal("HTTPServer"), *m_jobQueue, *m_networkOPs, *m_resourceManager))
, m_rpcServerHandler (*m_networkOPs, *m_resourceManager) // passive object, not a Service
, m_nodeStore (m_nodeStoreManager->make_Database ("NodeStore.main", m_nodeStoreScheduler,
- LogPartition::getJournal (), 4, // four read threads for now
+ m_logs.journal("NodeObject"), 4, // four read threads for now
getConfig ().nodeDatabase, getConfig ().ephemeralNodeDatabase))
, m_sntpClient (SNTPClient::New (*this))
@@ -344,12 +302,12 @@ public:
, m_validators (add (Validators::Manager::New (
*this,
getConfig ().getModuleDatabasePath (),
- LogPartition::getJournal ())))
+ m_logs.journal("Validators"))))
, m_amendmentTable (make_AmendmentTable (weeks(2), MAJORITY_FRACTION, // 204/256 about 80%
- LogPartition::getJournal ()))
+ m_logs.journal("AmendmentTable")))
- , mFeeTrack (LoadFeeTrack::New (LogPartition::getJournal ()))
+ , mFeeTrack (LoadFeeTrack::New (m_logs.journal("LoadManager")))
, mHashRouter (IHashRouter::New (IHashRouter::getDefaultHoldTime ()))
@@ -357,7 +315,7 @@ public:
, mProofOfWorkFactory (ProofOfWorkFactory::New ())
- , m_loadManager (LoadManager::New (*this, LogPartition::getJournal ()))
+ , m_loadManager (LoadManager::New (*this, m_logs.journal("LoadManager")))
, m_sweepTimer (this)
@@ -366,8 +324,7 @@ public:
, m_resolver (ResolverAsio::New (m_mainIoPool.getService (), beast::Journal ()))
, m_io_latency_sampler (m_collectorManager->collector()->make_event ("ios_latency"),
- LogPartition::getJournal (),
- std::chrono::milliseconds (100), m_mainIoPool.getService())
+ m_logs.journal("Application"), std::chrono::milliseconds (100), m_mainIoPool.getService())
{
add (m_resourceManager.get ());
@@ -641,15 +598,10 @@ public:
if (!getConfig ().DEBUG_LOGFILE.empty ())
{
// Let debug messages go to the file but only WARNING or higher to regular output (unless verbose)
- LogSink::get()->setLogFile (getConfig ().DEBUG_LOGFILE);
+ m_logs.open(getConfig ().DEBUG_LOGFILE);
- if (LogSink::get()->getMinSeverity () > lsDEBUG)
- LogPartition::setSeverity (lsDEBUG);
- }
-
- if (!getConfig().CONSOLE_LOG_OUTPUT.empty())
- {
- LogPartition::setConsoleOutput (getConfig().CONSOLE_LOG_OUTPUT);
+ if (m_logs.severity() > beast::Journal::kDebug)
+ m_logs.severity (beast::Journal::kDebug);
}
if (!getConfig ().RUN_STANDALONE)
@@ -1436,7 +1388,7 @@ static bool schemaHas (DatabaseCon* dbc, const std::string& dbName, int line, co
if (static_cast (schema.size ()) <= line)
{
- Log (lsFATAL) << "Schema for " << dbName << " has too few lines";
+ WriteLog (lsFATAL, Application) << "Schema for " << dbName << " has too few lines";
throw std::runtime_error ("bad schema");
}
@@ -1448,14 +1400,14 @@ static void addTxnSeqField ()
if (schemaHas (getApp().getTxnDB (), "AccountTransactions", 0, "TxnSeq"))
return;
- Log (lsWARNING) << "Transaction sequence field is missing";
+ WriteLog (lsWARNING, Application) << "Transaction sequence field is missing";
Database* db = getApp().getTxnDB ()->getDB ();
std::vector< std::pair > txIDs;
txIDs.reserve (300000);
- Log (lsINFO) << "Parsing transactions";
+ WriteLog (lsINFO, Application) << "Parsing transactions";
int i = 0;
uint256 transID;
SQL_FOREACH (db, "SELECT TransID,TxnMeta FROM Transactions;")
@@ -1479,7 +1431,7 @@ static void addTxnSeqField ()
if (rawMeta.size () == 0)
{
txIDs.push_back (std::make_pair (transID, -1));
- Log (lsINFO) << "No metadata for " << transID;
+ WriteLog (lsINFO, Application) << "No metadata for " << transID;
}
else
{
@@ -1488,17 +1440,19 @@ static void addTxnSeqField ()
}
if ((++i % 1000) == 0)
- Log (lsINFO) << i << " transactions read";
+ {
+ WriteLog (lsINFO, Application) << i << " transactions read";
+ }
}
- Log (lsINFO) << "All " << i << " transactions read";
+ WriteLog (lsINFO, Application) << "All " << i << " transactions read";
db->executeSQL ("BEGIN TRANSACTION;");
- Log (lsINFO) << "Dropping old index";
+ WriteLog (lsINFO, Application) << "Dropping old index";
db->executeSQL ("DROP INDEX AcctTxIndex;");
- Log (lsINFO) << "Altering table";
+ WriteLog (lsINFO, Application) << "Altering table";
db->executeSQL ("ALTER TABLE AccountTransactions ADD COLUMN TxnSeq INTEGER;");
boost::format fmt ("UPDATE AccountTransactions SET TxnSeq = %d WHERE TransID = '%s';");
@@ -1508,10 +1462,12 @@ static void addTxnSeqField ()
db->executeSQL (boost::str (fmt % t.second % to_string (t.first)));
if ((++i % 1000) == 0)
- Log (lsINFO) << i << " transactions updated";
+ {
+ WriteLog (lsINFO, Application) << i << " transactions updated";
+ }
}
- Log (lsINFO) << "Building new index";
+ WriteLog (lsINFO, Application) << "Building new index";
db->executeSQL ("CREATE INDEX AcctTxIndex ON AccountTransactions(Account, LedgerSeq, TxnSeq, TransID);");
db->executeSQL ("END TRANSACTION;");
}
@@ -1520,7 +1476,7 @@ void ApplicationImp::updateTables ()
{
if (getConfig ().nodeDatabase.size () <= 0)
{
- Log (lsFATAL) << "The [node_db] configuration setting has been updated and must be set";
+ WriteLog (lsFATAL, Application) << "The [node_db] configuration setting has been updated and must be set";
StopSustain ();
exit (1);
}
@@ -1532,7 +1488,7 @@ void ApplicationImp::updateTables ()
if (schemaHas (getApp().getTxnDB (), "AccountTransactions", 0, "PRIMARY"))
{
- Log (lsFATAL) << "AccountTransactions database should not have a primary key";
+ WriteLog (lsFATAL, Application) << "AccountTransactions database should not have a primary key";
StopSustain ();
exit (1);
}
@@ -1542,7 +1498,7 @@ void ApplicationImp::updateTables ()
NodeStore::DummyScheduler scheduler;
std::unique_ptr source (
m_nodeStoreManager->make_Database ("NodeStore.import", scheduler,
- LogPartition::getJournal (), 0,
+ deprecatedLogs().journal("NodeObject"), 0,
getConfig ().importNodeDatabase));
WriteLog (lsWARNING, NodeObject) <<
@@ -1565,9 +1521,10 @@ Application::Application ()
{
}
-std::unique_ptr make_Application ()
+std::unique_ptr
+make_Application (Logs& logs)
{
- return std::make_unique ();
+ return std::make_unique (logs);
}
Application& getApp ()
diff --git a/src/ripple/module/app/main/Application.h b/src/ripple/module/app/main/Application.h
index 180f0e7a1..b4d59ae40 100644
--- a/src/ripple/module/app/main/Application.h
+++ b/src/ripple/module/app/main/Application.h
@@ -34,6 +34,7 @@ namespace RPC { class Manager; }
class CollectorManager;
class AmendmentTable;
class IHashRouter;
+class Logs;
class LoadFeeTrack;
class Overlay;
class UniqueNodeList;
@@ -77,7 +78,7 @@ public:
public:
Application ();
- virtual ~Application () { }
+ virtual ~Application () = default;
virtual boost::asio::io_service& getIOService () = 0;
virtual CollectorManager& getCollectorManager () = 0;
@@ -134,7 +135,8 @@ public:
As long as there are legacy calls to getApp it is not safe
to create more than one Application object at a time.
*/
-std::unique_ptr make_Application();
+std::unique_ptr
+make_Application(Logs& logs);
// VFALCO DEPRECATED
//
diff --git a/src/ripple/module/app/main/FatalErrorReporter.cpp b/src/ripple/module/app/main/FatalErrorReporter.cpp
index 4224b5bb4..bea56ccb1 100644
--- a/src/ripple/module/app/main/FatalErrorReporter.cpp
+++ b/src/ripple/module/app/main/FatalErrorReporter.cpp
@@ -35,7 +35,7 @@ FatalErrorReporter::~FatalErrorReporter ()
void FatalErrorReporter::reportMessage (beast::String& formattedMessage)
{
- Log::out() << formattedMessage.toRawUTF8 ();
+ std::cerr << formattedMessage.toRawUTF8 () << std::endl;
}
//------------------------------------------------------------------------------
diff --git a/src/ripple/module/app/main/LocalCredentials.cpp b/src/ripple/module/app/main/LocalCredentials.cpp
index fc6835191..833fa0c82 100644
--- a/src/ripple/module/app/main/LocalCredentials.cpp
+++ b/src/ripple/module/app/main/LocalCredentials.cpp
@@ -39,7 +39,7 @@ void LocalCredentials::start ()
}
if (!getConfig ().QUIET)
- Log::out() << "NodeIdentity: " << mNodePublicKey.humanNodePublic ();
+ std::cerr << "NodeIdentity: " << mNodePublicKey.humanNodePublic () << std::endl;
getApp().getUNL ().start ();
}
@@ -78,7 +78,7 @@ bool LocalCredentials::nodeIdentityLoad ()
bool LocalCredentials::nodeIdentityCreate ()
{
if (!getConfig ().QUIET)
- Log::out() << "NodeIdentity: Creating.";
+ std::cerr << "NodeIdentity: Creating." << std::endl;
//
// Generate the public and private key
@@ -115,7 +115,7 @@ bool LocalCredentials::nodeIdentityCreate ()
// XXX Check error result.
if (!getConfig ().QUIET)
- Log::out() << "NodeIdentity: Created.";
+ std::cerr << "NodeIdentity: Created." << std::endl;
return true;
}
diff --git a/src/ripple/module/app/main/Main.cpp b/src/ripple/module/app/main/Main.cpp
index 5ebe28169..621d69ae4 100644
--- a/src/ripple/module/app/main/Main.cpp
+++ b/src/ripple/module/app/main/Main.cpp
@@ -56,7 +56,7 @@ void startServer ()
const Json::Value& jvCommand = getConfig ().RPC_STARTUP[i];
if (!getConfig ().QUIET)
- Log::out() << "Startup RPC: " << jvCommand;
+ std::cerr << "Startup RPC: " << jvCommand << std::endl;
RPCHandler rhHandler (getApp().getOPs ());
@@ -64,7 +64,7 @@ void startServer ()
Json::Value jvResult = rhHandler.doCommand (jvCommand, Config::ADMIN, loadType);
if (!getConfig ().QUIET)
- Log::out() << "Result: " << jvResult;
+ std::cerr << "Result: " << jvResult << std::endl;
}
}
@@ -136,7 +136,7 @@ runUnitTests (std::string pattern, std::string format)
// Config needs to be set up before creating Application
setupConfigForUnitTests (&getConfig ());
// VFALCO TODO Remove dependence on constructing Application object
- auto app (make_Application());
+ std::unique_ptr app (make_Application (deprecatedLogs()));
using namespace beast::unit_test;
beast::debug_ostream stream;
reporter r (stream);
@@ -205,7 +205,7 @@ int run (int argc, char** argv)
if (! RandomNumbers::getInstance ().initialize ())
{
- Log::out() << "Unable to add system entropy";
+ std::cerr << "Unable to add system entropy" << std::endl;
iResult = 2;
}
@@ -251,20 +251,20 @@ int run (int argc, char** argv)
std::string logMe = DoSustain (getConfig ().DEBUG_LOGFILE.string());
if (!logMe.empty ())
- Log (lsWARNING) << logMe;
+ std::cerr << logMe;
}
if (vm.count ("quiet"))
{
- LogSink::get()->setMinSeverity (lsFATAL, true);
+ deprecatedLogs().severity(beast::Journal::kFatal);
}
else if (vm.count ("verbose"))
{
- LogSink::get()->setMinSeverity (lsTRACE, true);
+ deprecatedLogs().severity(beast::Journal::kTrace);
}
else
{
- LogSink::get()->setMinSeverity (lsINFO, true);
+ deprecatedLogs().severity(beast::Journal::kInfo);
}
// Run the unit tests if requested.
@@ -352,7 +352,7 @@ int run (int argc, char** argv)
if (!vm.count ("parameters"))
{
// No arguments. Run server.
- std::unique_ptr app (make_Application ());
+ std::unique_ptr app (make_Application (deprecatedLogs()));
setupServer ();
startServer ();
}
diff --git a/src/ripple/module/app/misc/AccountState.cpp b/src/ripple/module/app/misc/AccountState.cpp
index 9e1c588b8..c24aba696 100644
--- a/src/ripple/module/app/misc/AccountState.cpp
+++ b/src/ripple/module/app/misc/AccountState.cpp
@@ -78,7 +78,7 @@ void AccountState::dump ()
{
Json::Value j (Json::objectValue);
addJson (j);
- Log (lsINFO) << j;
+ WriteLog (lsINFO, Ledger) << j;
}
} // ripple
diff --git a/src/ripple/module/app/misc/NetworkOPs.cpp b/src/ripple/module/app/misc/NetworkOPs.cpp
index 98ba66270..3261be626 100644
--- a/src/ripple/module/app/misc/NetworkOPs.cpp
+++ b/src/ripple/module/app/misc/NetworkOPs.cpp
@@ -26,11 +26,6 @@
namespace ripple {
-class FeeVoteLog;
-template <>
-char const*
-LogPartition::getPartitionName () { return "FeeVote"; }
-
class NetworkOPsImp
: public NetworkOPs
, public beast::DeadlineTimer::Listener
@@ -54,7 +49,7 @@ public:
, m_journal (journal)
, m_localTX (LocalTxs::New ())
, m_feeVote (make_FeeVote(10, 20 * SYSTEM_CURRENCY_PARTS,
- 5 * SYSTEM_CURRENCY_PARTS, LogPartition::getJournal ()))
+ 5 * SYSTEM_CURRENCY_PARTS, deprecatedLogs().journal("FeeVote")))
, mMode (omDISCONNECTED)
, mNeedNetworkLedger (false)
, mProposing (false)
@@ -69,7 +64,7 @@ public:
, mLastCloseTime (0)
, mLastValidationTime (0)
, mFetchPack ("FetchPack", 65536, 45, clock,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("TaggedCache"))
, mFetchSeq (0)
, mLastLoadBase (256)
, mLastLoadFactor (256)
@@ -1741,7 +1736,8 @@ void NetworkOPsImp::setMode (OperatingMode om)
mMode = om;
- Log ((om < mMode) ? lsWARNING : lsINFO) << "STATE->" << strOperatingMode ();
+ m_journal.stream((om < mMode) ? beast::Journal::kWarning : beast::Journal::kInfo) <<
+ "STATE->" << strOperatingMode ();
pubServer ();
}
diff --git a/src/ripple/module/app/misc/ProofOfWork.cpp b/src/ripple/module/app/misc/ProofOfWork.cpp
index 8b84321d9..1f5dc4b12 100644
--- a/src/ripple/module/app/misc/ProofOfWork.cpp
+++ b/src/ripple/module/app/misc/ProofOfWork.cpp
@@ -22,8 +22,6 @@
namespace ripple {
-SETUP_LOG (ProofOfWork)
-
// VFALCO TODO Move these to a header
const uint256 ProofOfWork::sMinTarget ("00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
diff --git a/src/ripple/module/app/misc/SerializedLedger.cpp b/src/ripple/module/app/misc/SerializedLedger.cpp
index d44d08001..45d3abcb7 100644
--- a/src/ripple/module/app/misc/SerializedLedger.cpp
+++ b/src/ripple/module/app/misc/SerializedLedger.cpp
@@ -19,10 +19,6 @@
namespace ripple {
-struct SerializedLedgerLog; // for Log
-
-SETUP_LOGN (SerializedLedgerLog,"SerializedLedger")
-
SerializedLedgerEntry::SerializedLedgerEntry (
SerializerIterator& sit, uint256 const& index)
: STObject (sfLedgerEntry), mIndex (index), mMutable (true)
@@ -59,9 +55,9 @@ void SerializedLedgerEntry::setSLEType ()
mType = item->getType ();
if (!setType (item->elements))
{
- WriteLog (lsWARNING, SerializedLedgerLog)
+ WriteLog (lsWARNING, SerializedLedger)
<< "Ledger entry not valid for type " << mFormat->getName ();
- WriteLog (lsWARNING, SerializedLedgerLog) << getJson (0);
+ WriteLog (lsWARNING, SerializedLedger) << getJson (0);
throw std::runtime_error ("ledger entry not valid for type");
}
}
@@ -143,7 +139,7 @@ bool SerializedLedgerEntry::thread (uint256 const& txID, std::uint32_t ledgerSeq
uint256& prevTxID, std::uint32_t& prevLedgerID)
{
uint256 oldPrevTxID = getFieldH256 (sfPreviousTxnID);
- WriteLog (lsTRACE, SerializedLedgerLog) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
+ WriteLog (lsTRACE, SerializedLedger) << "Thread Tx:" << txID << " prev:" << oldPrevTxID;
if (oldPrevTxID == txID)
{
diff --git a/src/ripple/module/app/misc/SerializedTransaction.cpp b/src/ripple/module/app/misc/SerializedTransaction.cpp
index 7fbd13a33..0add87fa4 100644
--- a/src/ripple/module/app/misc/SerializedTransaction.cpp
+++ b/src/ripple/module/app/misc/SerializedTransaction.cpp
@@ -21,8 +21,6 @@
namespace ripple {
-SETUP_LOG (SerializedTransaction)
-
SerializedTransaction::SerializedTransaction (TxType type)
: STObject (sfTransaction)
, mType (type)
@@ -69,7 +67,7 @@ SerializedTransaction::SerializedTransaction (SerializerIterator& sit) : STObjec
if ((length < Protocol::txMinSizeBytes) || (length > Protocol::txMaxSizeBytes))
{
- Log (lsERROR) << "Transaction has invalid length: " << length;
+ WriteLog (lsERROR, SerializedTransaction) << "Transaction has invalid length: " << length;
throw std::runtime_error ("Transaction length invalid");
}
diff --git a/src/ripple/module/app/misc/Validations.cpp b/src/ripple/module/app/misc/Validations.cpp
index 7dc5dc489..f0fdcdcec 100644
--- a/src/ripple/module/app/misc/Validations.cpp
+++ b/src/ripple/module/app/misc/Validations.cpp
@@ -23,8 +23,6 @@ namespace ripple {
class ValidationsImp;
-SETUP_LOG (Validations)
-
typedef std::map::value_type u160_val_pair;
typedef std::shared_ptr VSpointer;
@@ -64,7 +62,7 @@ private:
public:
ValidationsImp ()
: mValidations ("Validations", 128, 600, get_seconds_clock (),
- LogPartition::getJournal ())
+ deprecatedLogs().journal("TaggedCache"))
, mWriting (false)
{
mStaleValidations.reserve (512);
diff --git a/src/ripple/module/app/paths/PathRequest.cpp b/src/ripple/module/app/paths/PathRequest.cpp
index 04ebeda52..6488486eb 100644
--- a/src/ripple/module/app/paths/PathRequest.cpp
+++ b/src/ripple/module/app/paths/PathRequest.cpp
@@ -24,8 +24,6 @@
namespace ripple {
-SETUP_LOG (PathRequest)
-
PathRequest::PathRequest (
const std::shared_ptr& subscriber, int id, PathRequests& owner,
beast::Journal journal)
diff --git a/src/ripple/module/app/paths/Pathfinder.cpp b/src/ripple/module/app/paths/Pathfinder.cpp
index 734bf6ff3..8e0cd3094 100644
--- a/src/ripple/module/app/paths/Pathfinder.cpp
+++ b/src/ripple/module/app/paths/Pathfinder.cpp
@@ -23,8 +23,6 @@
namespace ripple {
-SETUP_LOG (Pathfinder)
-
/*
we just need to find a succession of the highest quality paths there until we find enough width
diff --git a/src/ripple/module/app/paths/RippleCalc.cpp b/src/ripple/module/app/paths/RippleCalc.cpp
index 2e8ea2351..ecd6d5676 100644
--- a/src/ripple/module/app/paths/RippleCalc.cpp
+++ b/src/ripple/module/app/paths/RippleCalc.cpp
@@ -33,8 +33,6 @@
namespace ripple {
-SETUP_LOG (RippleCalc)
-
namespace path {
// OPTIMIZE: When calculating path increment, note if increment consumes all
diff --git a/src/ripple/module/app/peers/UniqueNodeList.cpp b/src/ripple/module/app/peers/UniqueNodeList.cpp
index db2748e89..e33f4cac4 100644
--- a/src/ripple/module/app/peers/UniqueNodeList.cpp
+++ b/src/ripple/module/app/peers/UniqueNodeList.cpp
@@ -60,8 +60,6 @@ namespace ripple {
#define REFERRAL_VALIDATORS_MAX 50
#define REFERRAL_IPS_MAX 50
-SETUP_LOG (UniqueNodeList)
-
// VFALCO TODO move all function definitions inlined into the class.
class UniqueNodeListImp
: public UniqueNodeList
diff --git a/src/ripple/module/app/shamap/SHAMap.cpp b/src/ripple/module/app/shamap/SHAMap.cpp
index c8b67f5b2..577ca5e05 100644
--- a/src/ripple/module/app/shamap/SHAMap.cpp
+++ b/src/ripple/module/app/shamap/SHAMap.cpp
@@ -22,8 +22,6 @@
namespace ripple {
-SETUP_LOG (SHAMap)
-
void SHAMap::DefaultMissingNodeHandler::operator() (std::uint32_t refNUm)
{
getApp().getOPs ().missingNodeInLedger (refNUm);
@@ -71,7 +69,7 @@ SHAMap::SHAMap (SHAMapType t, uint256 const& hash, FullBelowCache& fullBelowCach
TaggedCache
SHAMap::treeNodeCache ("TreeNodeCache", 65536, 60,
get_seconds_clock (),
- LogPartition::getJournal ());
+ deprecatedLogs().journal("TaggedCache"));
SHAMap::~SHAMap ()
{
diff --git a/src/ripple/module/app/shamap/SHAMapNode.cpp b/src/ripple/module/app/shamap/SHAMapNode.cpp
index ce295fcdc..19a3da3de 100644
--- a/src/ripple/module/app/shamap/SHAMapNode.cpp
+++ b/src/ripple/module/app/shamap/SHAMapNode.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (SHAMapNode)
-
// canonicalize the hash to a node ID for this depth
SHAMapNode::SHAMapNode (int depth, uint256 const& hash) : mNodeID (hash), mDepth (depth), mHash (0)
{
@@ -153,8 +151,8 @@ int SHAMapNode::selectBranch (uint256 const& hash) const
if ((hash & smMasks[mDepth]) != mNodeID)
{
- Log::out() << "selectBranch(" << getString ();
- Log::out() << " " << hash << " off branch";
+ std::cerr << "selectBranch(" << getString () << std::endl;
+ std::cerr << " " << hash << " off branch" << std::endl;
assert (false);
return -1; // does not go under this node
}
diff --git a/src/ripple/module/app/shamap/SHAMapTreeNode.cpp b/src/ripple/module/app/shamap/SHAMapTreeNode.cpp
index 321f954c4..c2eb28974 100644
--- a/src/ripple/module/app/shamap/SHAMapTreeNode.cpp
+++ b/src/ripple/module/app/shamap/SHAMapTreeNode.cpp
@@ -60,8 +60,8 @@ SHAMapTreeNode::SHAMapTreeNode (const SHAMapNode& id, Blob const& rawNode, std::
if ((type < 0) || (type > 4))
{
#ifdef BEAST_DEBUG
- Log::out() << "Invalid wire format node";
- Log::out() << strHex (rawNode);
+ deprecatedLogs().journal("SHAMapTreeNode").fatal <<
+ "Invalid wire format node" << strHex (rawNode);
assert (false);
#endif
throw std::runtime_error ("invalid node AW type");
diff --git a/src/ripple/module/app/transactors/AddWallet.h b/src/ripple/module/app/transactors/AddWallet.h
index 1f4b83161..37e7610d2 100644
--- a/src/ripple/module/app/transactors/AddWallet.h
+++ b/src/ripple/module/app/transactors/AddWallet.h
@@ -22,15 +22,6 @@
namespace ripple {
-class AddWalletLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/WalletAdd";
-}
-
class AddWallet
: public Transactor
{
@@ -43,7 +34,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("AddWallet"))
{
}
diff --git a/src/ripple/module/app/transactors/CancelOffer.h b/src/ripple/module/app/transactors/CancelOffer.h
index a08387e11..64b3b3fb6 100644
--- a/src/ripple/module/app/transactors/CancelOffer.h
+++ b/src/ripple/module/app/transactors/CancelOffer.h
@@ -22,15 +22,6 @@
namespace ripple {
-class CancelOfferLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/OfferCancel";
-}
-
class CancelOffer
: public Transactor
{
@@ -43,7 +34,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("CancelOffer"))
{
}
diff --git a/src/ripple/module/app/transactors/Change.h b/src/ripple/module/app/transactors/Change.h
index 45b827630..d53d15662 100644
--- a/src/ripple/module/app/transactors/Change.h
+++ b/src/ripple/module/app/transactors/Change.h
@@ -22,14 +22,6 @@
namespace ripple {
-class ChangeLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/Change";
-}
class Change
: public Transactor
@@ -43,7 +35,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("Change"))
{
}
diff --git a/src/ripple/module/app/transactors/CreateOffer.cpp b/src/ripple/module/app/transactors/CreateOffer.cpp
index 6865cfc47..335dd01c8 100644
--- a/src/ripple/module/app/transactors/CreateOffer.cpp
+++ b/src/ripple/module/app/transactors/CreateOffer.cpp
@@ -38,7 +38,7 @@ CreateOffer::CreateOffer (
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("CreateOffer"))
{
}
diff --git a/src/ripple/module/app/transactors/CreateOffer.h b/src/ripple/module/app/transactors/CreateOffer.h
index 61a44502c..24a51ac64 100644
--- a/src/ripple/module/app/transactors/CreateOffer.h
+++ b/src/ripple/module/app/transactors/CreateOffer.h
@@ -27,15 +27,6 @@
namespace ripple {
-class CreateOfferLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/OfferCreate";
-}
-
class CreateOffer
: public Transactor
{
diff --git a/src/ripple/module/app/transactors/Payment.h b/src/ripple/module/app/transactors/Payment.h
index c0042f1aa..9649caf49 100644
--- a/src/ripple/module/app/transactors/Payment.h
+++ b/src/ripple/module/app/transactors/Payment.h
@@ -22,15 +22,6 @@
namespace ripple {
-class PaymentLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/Payment";
-}
-
class Payment
: public Transactor
{
@@ -46,7 +37,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("Payment"))
{
}
diff --git a/src/ripple/module/app/transactors/SetAccount.h b/src/ripple/module/app/transactors/SetAccount.h
index 7eddb09c4..77386befa 100644
--- a/src/ripple/module/app/transactors/SetAccount.h
+++ b/src/ripple/module/app/transactors/SetAccount.h
@@ -22,15 +22,6 @@
namespace ripple {
-class SetAccountLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/AccountSet";
-}
-
class SetAccount
: public Transactor
{
@@ -43,7 +34,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("SetAccount"))
{
}
diff --git a/src/ripple/module/app/transactors/SetRegularKey.h b/src/ripple/module/app/transactors/SetRegularKey.h
index d333d5568..2bc30c94b 100644
--- a/src/ripple/module/app/transactors/SetRegularKey.h
+++ b/src/ripple/module/app/transactors/SetRegularKey.h
@@ -22,15 +22,6 @@
namespace ripple {
-class SetRegularKeyLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/RegularKeySet";
-}
-
class SetRegularKey
: public Transactor
{
@@ -45,7 +36,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("SetRegularKey"))
{
}
diff --git a/src/ripple/module/app/transactors/SetTrust.h b/src/ripple/module/app/transactors/SetTrust.h
index b9503c069..c50fe9b7b 100644
--- a/src/ripple/module/app/transactors/SetTrust.h
+++ b/src/ripple/module/app/transactors/SetTrust.h
@@ -22,15 +22,6 @@
namespace ripple {
-class SetTrustLog;
-
-template <>
-char const*
-LogPartition::getPartitionName ()
-{
- return "Tx/TrustSet";
-}
-
class SetTrust
: public Transactor
{
@@ -43,7 +34,7 @@ public:
txn,
params,
engine,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("SetTrust"))
{
}
diff --git a/src/ripple/module/app/tx/Transaction.cpp b/src/ripple/module/app/tx/Transaction.cpp
index 7352d4cdc..c38abd46d 100644
--- a/src/ripple/module/app/tx/Transaction.cpp
+++ b/src/ripple/module/app/tx/Transaction.cpp
@@ -50,7 +50,7 @@ Transaction::pointer Transaction::sharedTransaction (Blob const& vucTransaction,
}
catch (...)
{
- Log (lsWARNING) << "Exception constructing transaction";
+ WriteLog (lsWARNING, Ledger) << "Exception constructing transaction";
return std::shared_ptr ();
}
}
@@ -72,9 +72,6 @@ Transaction::Transaction (
mTransaction = std::make_shared (ttKind);
- // Log(lsINFO) << str(boost::format("Transaction: account: %s") % naSourceAccount.humanAccountID());
- // Log(lsINFO) << str(boost::format("Transaction: mAccountFrom: %s") % mAccountFrom.humanAccountID());
-
mTransaction->setSigningPubKey (mFromPubKey);
mTransaction->setSourceAccount (mAccountFrom);
mTransaction->setSequence (uSeq);
@@ -93,7 +90,7 @@ bool Transaction::sign (const RippleAddress& naAccountPrivate)
if (!naAccountPrivate.isValid ())
{
- Log (lsWARNING) << "No private key for signing";
+ WriteLog (lsWARNING, Ledger) << "No private key for signing";
bResult = false;
}
@@ -123,7 +120,7 @@ bool Transaction::checkSign () const
{
if (!mFromPubKey.isValid ())
{
- Log (lsWARNING) << "Transaction has bad source public key";
+ WriteLog (lsWARNING, Ledger) << "Transaction has bad source public key";
return false;
}
diff --git a/src/ripple/module/app/tx/TransactionAcquire.cpp b/src/ripple/module/app/tx/TransactionAcquire.cpp
index a9ce36800..8ee9d7afe 100644
--- a/src/ripple/module/app/tx/TransactionAcquire.cpp
+++ b/src/ripple/module/app/tx/TransactionAcquire.cpp
@@ -21,9 +21,6 @@
namespace ripple {
-//SETUP_LOG (TransactionAcquire)
-template <> char const* LogPartition::getPartitionName () { return "TxAcquire"; }
-
enum
{
// VFALCO NOTE This should be a std::chrono::duration constant.
@@ -36,7 +33,7 @@ typedef std::map::value_type u256_lct_pair;
TransactionAcquire::TransactionAcquire (uint256 const& hash, clock_type& clock)
: PeerSet (hash, TX_ACQUIRE_TIMEOUT, true, clock,
- LogPartition::getJournal ())
+ deprecatedLogs().journal("TransactionAcquire"))
, mHaveRoot (false)
{
mMap = std::make_shared (smtTRANSACTION, hash,
diff --git a/src/ripple/module/app/tx/TransactionEngine.cpp b/src/ripple/module/app/tx/TransactionEngine.cpp
index 57a59bafd..67274705d 100644
--- a/src/ripple/module/app/tx/TransactionEngine.cpp
+++ b/src/ripple/module/app/tx/TransactionEngine.cpp
@@ -23,8 +23,6 @@ namespace ripple {
// XXX Make sure all fields are recognized in transactions.
//
-SETUP_LOG (TransactionEngine)
-
void TransactionEngine::txnWrite ()
{
// Write back the account states
diff --git a/src/ripple/module/app/tx/TransactionMaster.cpp b/src/ripple/module/app/tx/TransactionMaster.cpp
index 740859a70..7f9178ecd 100644
--- a/src/ripple/module/app/tx/TransactionMaster.cpp
+++ b/src/ripple/module/app/tx/TransactionMaster.cpp
@@ -21,7 +21,7 @@ namespace ripple {
TransactionMaster::TransactionMaster ()
: mCache ("TransactionCache", 65536, 1800, get_seconds_clock (),
- LogPartition::getJournal ())
+ deprecatedLogs().journal("TaggedCache"))
{
}
diff --git a/src/ripple/module/app/tx/TransactionMeta.cpp b/src/ripple/module/app/tx/TransactionMeta.cpp
index ceab83338..1643f2895 100644
--- a/src/ripple/module/app/tx/TransactionMeta.cpp
+++ b/src/ripple/module/app/tx/TransactionMeta.cpp
@@ -21,8 +21,6 @@ namespace ripple {
// VFALCO TODO rename class to TransactionMeta
-SETUP_LOG (TransactionMetaSet)
-
TransactionMetaSet::TransactionMetaSet (uint256 const& txid, std::uint32_t ledger, Blob const& vec) :
mTransactionID (txid), mLedger (ledger), mNodes (sfAffectedNodes, 32)
{
diff --git a/src/ripple/module/app/websocket/WSConnection.cpp b/src/ripple/module/app/websocket/WSConnection.cpp
index 30e59f0b7..3c1244fa0 100644
--- a/src/ripple/module/app/websocket/WSConnection.cpp
+++ b/src/ripple/module/app/websocket/WSConnection.cpp
@@ -21,10 +21,6 @@
namespace ripple {
-SETUP_LOGN (WSConnection, "WSConnection")
-
-//------------------------------------------------------------------------------
-
WSConnection::WSConnection (Resource::Manager& resourceManager,
Resource::Consumer usage, InfoSub::Source& source, bool isPublic,
beast::IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service)
diff --git a/src/ripple/module/app/websocket/WSDoor.cpp b/src/ripple/module/app/websocket/WSDoor.cpp
index 5fd50a0cd..5f989c014 100644
--- a/src/ripple/module/app/websocket/WSDoor.cpp
+++ b/src/ripple/module/app/websocket/WSDoor.cpp
@@ -22,8 +22,6 @@
namespace ripple {
-SETUP_LOG (WSDoor)
-
//
// This is a light weight, untrusted interface for web clients.
// For now we don't provide proof. Later we will.
diff --git a/src/ripple/module/app/websocket/WSServerHandler.cpp b/src/ripple/module/app/websocket/WSServerHandler.cpp
index 2f755da51..e27dda6ee 100644
--- a/src/ripple/module/app/websocket/WSServerHandler.cpp
+++ b/src/ripple/module/app/websocket/WSServerHandler.cpp
@@ -21,6 +21,4 @@
namespace ripple {
-SETUP_LOGN (WSServerHandlerLog,"WSServerHandler")
-
} // ripple
diff --git a/src/ripple/module/core/functional/Config.cpp b/src/ripple/module/core/functional/Config.cpp
index bf36e6142..bd7374850 100644
--- a/src/ripple/module/core/functional/Config.cpp
+++ b/src/ripple/module/core/functional/Config.cpp
@@ -235,10 +235,6 @@ void Config::setup (const std::string& strConf, bool bQuiet)
// Update default values
load ();
- // Log::out() << "CONFIG FILE: " << CONFIG_FILE;
- // Log::out() << "CONFIG DIR: " << CONFIG_DIR;
- // Log::out() << "DATA DIR: " << DATA_DIR;
-
boost::filesystem::create_directories (DATA_DIR, ec);
if (ec)
@@ -257,13 +253,13 @@ void Config::setup (const std::string& strConf, bool bQuiet)
void Config::load ()
{
if (!QUIET)
- Log::out() << "Loading: " << CONFIG_FILE;
+ std::cerr << "Loading: " << CONFIG_FILE << std::endl;
std::ifstream ifsConfig (CONFIG_FILE.c_str (), std::ios::in);
if (!ifsConfig)
{
- Log::out() << "Failed to open '" << CONFIG_FILE << "'.";
+ std::cerr << "Failed to open '" << CONFIG_FILE << "'." << std::endl;
}
else
{
@@ -274,7 +270,7 @@ void Config::load ()
if (ifsConfig.bad ())
{
- Log::out() << "Failed to read '" << CONFIG_FILE << "'.";
+ std::cerr << "Failed to read '" << CONFIG_FILE << "'." << std::endl;
}
else
{
@@ -593,9 +589,6 @@ void Config::load ()
if (SectionSingleB (secConfig, SECTION_DEBUG_LOGFILE, strTemp))
DEBUG_LOGFILE = strTemp;
-
- if (SectionSingleB (secConfig, SECTION_CONSOLE_LOG_OUTPUT, strTemp))
- CONSOLE_LOG_OUTPUT = strTemp;
}
}
}
diff --git a/src/ripple/module/core/functional/Config.h b/src/ripple/module/core/functional/Config.h
index 10df3b255..c11d913db 100644
--- a/src/ripple/module/core/functional/Config.h
+++ b/src/ripple/module/core/functional/Config.h
@@ -350,7 +350,6 @@ public:
bool QUIET;
boost::filesystem::path DEBUG_LOGFILE;
- std::string CONSOLE_LOG_OUTPUT;
bool ELB_SUPPORT; // Support Amazon ELB
diff --git a/src/ripple/module/core/functional/ConfigSections.h b/src/ripple/module/core/functional/ConfigSections.h
index e3ada3e0c..3d1436239 100644
--- a/src/ripple/module/core/functional/ConfigSections.h
+++ b/src/ripple/module/core/functional/ConfigSections.h
@@ -40,7 +40,6 @@ struct ConfigSection
#define SECTION_CLUSTER_NODES "cluster_nodes"
#define SECTION_DATABASE_PATH "database_path"
#define SECTION_DEBUG_LOGFILE "debug_logfile"
-#define SECTION_CONSOLE_LOG_OUTPUT "console_log_output"
#define SECTION_ELB_SUPPORT "elb_support"
#define SECTION_FEE_DEFAULT "fee_default"
#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create"
diff --git a/src/ripple/module/core/functional/LoadMonitor.cpp b/src/ripple/module/core/functional/LoadMonitor.cpp
index 7f84f661a..9869be72c 100644
--- a/src/ripple/module/core/functional/LoadMonitor.cpp
+++ b/src/ripple/module/core/functional/LoadMonitor.cpp
@@ -42,8 +42,6 @@ LoadMonitor::Stats::Stats()
//------------------------------------------------------------------------------
-SETUP_LOG (LoadMonitor)
-
LoadMonitor::LoadMonitor ()
: mCounts (0)
, mLatencyEvents (0)
diff --git a/src/ripple/module/data/crypto/CKeyECIES.cpp b/src/ripple/module/data/crypto/CKeyECIES.cpp
index a3dc24c4d..53472c11b 100644
--- a/src/ripple/module/data/crypto/CKeyECIES.cpp
+++ b/src/ripple/module/data/crypto/CKeyECIES.cpp
@@ -292,7 +292,6 @@ bool checkECIES (void)
if ((i % 100) == 0)
{
// generate new keys every 100 times
- // Log::out() << "new keys";
senderPriv.MakeNewKey ();
recipientPriv.MakeNewKey ();
@@ -321,8 +320,6 @@ bool checkECIES (void)
assert (false);
return false;
}
-
- //Log::out() << "Msg(" << msglen << ") ok " << ciphertext.size();
}
return true;
diff --git a/src/ripple/module/data/protocol/LedgerFormats.cpp b/src/ripple/module/data/protocol/LedgerFormats.cpp
index 32bc04464..45e3d04c0 100644
--- a/src/ripple/module/data/protocol/LedgerFormats.cpp
+++ b/src/ripple/module/data/protocol/LedgerFormats.cpp
@@ -17,6 +17,8 @@
*/
//==============================================================================
+#include
+
namespace ripple {
LedgerFormats::LedgerFormats ()
diff --git a/src/ripple/module/data/protocol/RippleAddress.cpp b/src/ripple/module/data/protocol/RippleAddress.cpp
index e5b82c72b..425f17998 100644
--- a/src/ripple/module/data/protocol/RippleAddress.cpp
+++ b/src/ripple/module/data/protocol/RippleAddress.cpp
@@ -21,8 +21,6 @@
namespace ripple {
-SETUP_LOG (RippleAddress)
-
RippleAddress::RippleAddress ()
: mIsValid (false)
{
@@ -807,7 +805,6 @@ bool RippleAddress::setSeedGeneric (const std::string& strText)
}
else
{
- // Log::out() << "Creating seed from pass phrase.";
setSeed (CKey::PassPhraseToKey (strText));
}
diff --git a/src/ripple/module/data/protocol/STAmount.cpp b/src/ripple/module/data/protocol/STAmount.cpp
index a48fd23d0..0ab07a5a0 100644
--- a/src/ripple/module/data/protocol/STAmount.cpp
+++ b/src/ripple/module/data/protocol/STAmount.cpp
@@ -21,8 +21,6 @@
namespace ripple {
-SETUP_LOG (STAmount)
-
std::uint64_t STAmount::uRateOne = STAmount::getRate (STAmount (1), STAmount (1));
bool STAmount::issuerFromString (uint160& uDstIssuer, const std::string& sIssuer)
@@ -67,7 +65,6 @@ bool STAmount::currencyFromString (uint160& uDstCurrency, const std::string& sCu
// std::string sIso;
// sIso.assign(vucIso.begin(), vucIso.end());
- // Log::out() << "currency: " << sIso;
Serializer s;
diff --git a/src/ripple/module/data/protocol/SerializedObject.cpp b/src/ripple/module/data/protocol/SerializedObject.cpp
index 7ae1fdd5c..ca131150c 100644
--- a/src/ripple/module/data/protocol/SerializedObject.cpp
+++ b/src/ripple/module/data/protocol/SerializedObject.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (STObject)
-
std::unique_ptr STObject::makeDefaultObject (SerializedTypeID id, SField::ref name)
{
assert ((id == STI_NOTPRESENT) || (id == name.fieldType));
@@ -1110,7 +1108,7 @@ bool STObject::operator== (const STObject& obj) const
if (!match)
{
- Log (lsTRACE) << "STObject::operator==: no match for " << t.getFName ().getName ();
+ WriteLog (lsTRACE, STObject) << "STObject::operator==: no match for " << t.getFName ().getName ();
return false;
}
}
@@ -1123,7 +1121,7 @@ bool STObject::operator== (const STObject& obj) const
if (fields != matches)
{
- Log (lsTRACE) << "STObject::operator==: " << fields << " fields, " << matches << " matches";
+ WriteLog (lsTRACE, STObject) << "STObject::operator==: " << fields << " fields, " << matches << " matches";
return false;
}
diff --git a/src/ripple/module/data/protocol/SerializedTypes.cpp b/src/ripple/module/data/protocol/SerializedTypes.cpp
index d89dc35b6..d550309a3 100644
--- a/src/ripple/module/data/protocol/SerializedTypes.cpp
+++ b/src/ripple/module/data/protocol/SerializedTypes.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (SerializedType)
-
const STAmount saZero (CURRENCY_ONE, ACCOUNT_ONE, 0);
const STAmount saOne (CURRENCY_ONE, ACCOUNT_ONE, 1);
@@ -46,40 +44,6 @@ bool SerializedType::isEquivalent (const SerializedType& t) const
return false;
}
-void STPathSet::printDebug ()
-{
- // VFALCO NOTE Can't use Log::out() because of std::endl
- //
- for (int i = 0; i < value.size (); i++)
- {
- std::cerr << i << ": ";
-
- for (int j = 0; j < value[i].mPath.size (); j++)
- {
- //STPathElement pe = value[i].mPath[j];
- RippleAddress nad;
- nad.setAccountID (value[i].mPath[j].mAccountID);
- std::cerr << " " << nad.humanAccountID ();
- //std::cerr << " " << pe.mAccountID.GetHex();
- }
-
- std::cerr << std::endl;
- }
-
-}
-
-void STPath::printDebug ()
-{
- Log::out() << "STPath:";
-
- for (int i = 0; i < mPath.size (); i++)
- {
- RippleAddress nad;
- nad.setAccountID (mPath[i].mAccountID);
- Log::out() << " " << i << ": " << nad.humanAccountID ();
- }
-}
-
std::string SerializedType::getFullText () const
{
std::string ret;
diff --git a/src/ripple/module/data/protocol/SerializedTypes.h b/src/ripple/module/data/protocol/SerializedTypes.h
index a10e33eb6..d4407619c 100644
--- a/src/ripple/module/data/protocol/SerializedTypes.h
+++ b/src/ripple/module/data/protocol/SerializedTypes.h
@@ -1305,7 +1305,6 @@ public:
;
}
- void printDebug ();
int size () const
{
return mPath.size ();
@@ -1493,8 +1492,6 @@ public:
return value.empty ();
}
- void printDebug ();
-
STPath& operator[](size_t n)
{
return value[n];
diff --git a/src/ripple/module/data/protocol/Serializer.cpp b/src/ripple/module/data/protocol/Serializer.cpp
index 7f6e10977..e58b9e4fa 100644
--- a/src/ripple/module/data/protocol/Serializer.cpp
+++ b/src/ripple/module/data/protocol/Serializer.cpp
@@ -21,8 +21,6 @@
namespace ripple {
-SETUP_LOG (Serializer)
-
int Serializer::addZeros (size_t uBytes)
{
int ret = mData.size ();
diff --git a/src/ripple/module/net/basics/HTTPClient.cpp b/src/ripple/module/net/basics/HTTPClient.cpp
index 6321bcb2b..625d1e314 100644
--- a/src/ripple/module/net/basics/HTTPClient.cpp
+++ b/src/ripple/module/net/basics/HTTPClient.cpp
@@ -19,6 +19,7 @@
#include
#include
+#include
namespace ripple {
@@ -26,10 +27,6 @@ namespace ripple {
// Fetch a web page via http or https.
//
-SETUP_LOG (HTTPClient)
-
-//------------------------------------------------------------------------------
-
class HTTPClientSSLContext
{
public:
diff --git a/src/ripple/module/net/basics/HTTPRequest.cpp b/src/ripple/module/net/basics/HTTPRequest.cpp
index 7f0fef5b9..9049f3554 100644
--- a/src/ripple/module/net/basics/HTTPRequest.cpp
+++ b/src/ripple/module/net/basics/HTTPRequest.cpp
@@ -23,8 +23,6 @@
namespace ripple {
-SETUP_LOG (HTTPRequest)
-
// Logic to handle incoming HTTP reqests
void HTTPRequest::reset ()
diff --git a/src/ripple/module/net/basics/RPCDoor.cpp b/src/ripple/module/net/basics/RPCDoor.cpp
index 8a976748e..3e2dc5da7 100644
--- a/src/ripple/module/net/basics/RPCDoor.cpp
+++ b/src/ripple/module/net/basics/RPCDoor.cpp
@@ -20,8 +20,6 @@
namespace ripple {
-SETUP_LOG (RPCDoor)
-
class RPCDoorImp : public RPCDoor, public beast::LeakChecked
{
public:
diff --git a/src/ripple/module/net/basics/SNTPClient.cpp b/src/ripple/module/net/basics/SNTPClient.cpp
index cf79b1bd7..3cdca96ca 100644
--- a/src/ripple/module/net/basics/SNTPClient.cpp
+++ b/src/ripple/module/net/basics/SNTPClient.cpp
@@ -22,8 +22,6 @@
namespace ripple {
-SETUP_LOG (SNTPClient)
-
// #define SNTP_DEBUG
static uint8_t SNTPQueryData[48] =
diff --git a/src/ripple/module/net/basics/impl/RPCServerImp.h b/src/ripple/module/net/basics/impl/RPCServerImp.h
index f92f3b96a..bd1f54129 100644
--- a/src/ripple/module/net/basics/impl/RPCServerImp.h
+++ b/src/ripple/module/net/basics/impl/RPCServerImp.h
@@ -21,8 +21,6 @@
namespace ripple {
-SETUP_LOG (RPCServer)
-
class RPCServerImp
: public RPCServer
, public std::enable_shared_from_this
diff --git a/src/ripple/module/net/rpc/RPCCall.cpp b/src/ripple/module/net/rpc/RPCCall.cpp
index ae26f0817..6ce213cd2 100644
--- a/src/ripple/module/net/rpc/RPCCall.cpp
+++ b/src/ripple/module/net/rpc/RPCCall.cpp
@@ -23,8 +23,6 @@ namespace ripple {
class RPCParser;
-SETUP_LOG (RPCParser)
-
static inline bool isSwitchChar (char c)
{
#ifdef __WXMSW__
@@ -1080,10 +1078,7 @@ void RPCCall::fromNetwork (
// Connect to localhost
if (!getConfig ().QUIET)
{
- Log::out() << "Connecting to: " << strIp << ":" << iPort;
- // Log::out() << "Username: " << strUsername << ":" << strPassword;
- // Log::out() << "Path: " << strPath;
- // Log::out() << "Method: " << strMethod;
+ std::cerr << "Connecting to: " << strIp << ":" << iPort << std::endl;
}
// HTTP basic authentication
@@ -1094,8 +1089,6 @@ void RPCCall::fromNetwork (
mapRequestHeaders["Authorization"] = std::string ("Basic ") + strUserPass64;
// Send request
- // Log(lsDEBUG) << "requesting" << std::endl;
- // WriteLog (lsDEBUG, RPCParser) << "send request " << strMethod << " : " << strRequest << std::endl;
const int RPC_REPLY_MAX_BYTES (256*1024*1024);
const int RPC_NOTIFY_SECONDS (600);
diff --git a/src/ripple/module/net/rpc/RPCErr.cpp b/src/ripple/module/net/rpc/RPCErr.cpp
index 910277a6c..d2dc3abd6 100644
--- a/src/ripple/module/net/rpc/RPCErr.cpp
+++ b/src/ripple/module/net/rpc/RPCErr.cpp
@@ -21,8 +21,6 @@ namespace ripple {
struct RPCErr;
-SETUP_LOG (RPCErr)
-
// VFALCO NOTE Deprecated function
Json::Value rpcError (int iError, Json::Value jvResult)
{
diff --git a/src/ripple/module/net/rpc/RPCSub.cpp b/src/ripple/module/net/rpc/RPCSub.cpp
index 9cd3116eb..20f878c13 100644
--- a/src/ripple/module/net/rpc/RPCSub.cpp
+++ b/src/ripple/module/net/rpc/RPCSub.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (RPCSub)
-
// Subscription object for JSON-RPC
class RPCSubImp
: public RPCSub
diff --git a/src/ripple/module/net/rpc/RPCUtil.cpp b/src/ripple/module/net/rpc/RPCUtil.cpp
index ab9487e0d..f837c9aff 100644
--- a/src/ripple/module/net/rpc/RPCUtil.cpp
+++ b/src/ripple/module/net/rpc/RPCUtil.cpp
@@ -19,11 +19,6 @@
namespace ripple {
-// Used for logging
-struct RPCLog;
-
-SETUP_LOGN (RPCLog, "RPC")
-
unsigned int const gMaxHTTPHeaderSize = 0x02000000;
std::string gFormatStr ("v1");
@@ -101,9 +96,9 @@ std::string getHTTPHeaderTimestamp ()
std::string HTTPReply (int nStatus, const std::string& strMsg)
{
- if (ShouldLog (lsTRACE, RPCLog))
+ if (ShouldLog (lsTRACE, RPC))
{
- WriteLog (lsTRACE, RPCLog) << "HTTP Reply " << nStatus << " " << strMsg;
+ WriteLog (lsTRACE, RPC) << "HTTP Reply " << nStatus << " " << strMsg;
}
std::string ret;
diff --git a/src/ripple/module/rpc/handlers/LogLevel.cpp b/src/ripple/module/rpc/handlers/LogLevel.cpp
index d2dd036ab..50646c1b1 100644
--- a/src/ripple/module/rpc/handlers/LogLevel.cpp
+++ b/src/ripple/module/rpc/handlers/LogLevel.cpp
@@ -29,17 +29,18 @@ Json::Value doLogLevel (RPC::Context& context)
Json::Value ret (Json::objectValue);
Json::Value lev (Json::objectValue);
- lev["base"] = Log::severityToString (LogSink::get()->getMinSeverity ());
- std::vector< std::pair > logTable = LogPartition::getSeverities ();
+ lev["base"] = Logs::toString(Logs::fromSeverity(deprecatedLogs().severity()));
+ std::vector< std::pair > logTable (
+ deprecatedLogs().partition_severities());
typedef std::map::value_type stringPair;
BOOST_FOREACH (const stringPair & it, logTable)
- lev[it.first] = it.second;
+ lev[it.first] = it.second;
ret["levels"] = lev;
return ret;
}
- LogSeverity sv = Log::stringToSeverity (context.params_["severity"].asString ());
+ LogSeverity const sv (Logs::fromString (context.params_["severity"].asString ()));
if (sv == lsINVALID)
return rpcError (rpcINVALID_PARAMS);
@@ -48,7 +49,7 @@ Json::Value doLogLevel (RPC::Context& context)
if (!context.params_.isMember ("partition"))
{
// set base log severity
- LogSink::get()->setMinSeverity (sv, true);
+ deprecatedLogs().severity(Logs::toSeverity(sv));
return Json::objectValue;
}
@@ -59,9 +60,9 @@ Json::Value doLogLevel (RPC::Context& context)
std::string partition (context.params_["partition"].asString ());
if (boost::iequals (partition, "base"))
- LogSink::get()->setMinSeverity (sv, false);
- else if (!LogPartition::setSeverity (partition, sv))
- return rpcError (rpcINVALID_PARAMS);
+ deprecatedLogs().severity (Logs::toSeverity(sv));
+ else
+ deprecatedLogs().get(partition).severity(Logs::toSeverity(sv));
return Json::objectValue;
}
diff --git a/src/ripple/module/rpc/handlers/LogRotate.cpp b/src/ripple/module/rpc/handlers/LogRotate.cpp
index 077dfafb6..a5683a8e8 100644
--- a/src/ripple/module/rpc/handlers/LogRotate.cpp
+++ b/src/ripple/module/rpc/handlers/LogRotate.cpp
@@ -23,7 +23,7 @@ namespace ripple {
Json::Value doLogRotate (RPC::Context& context)
{
context.lock_.unlock ();
- return LogSink::get()->rotateLog ();
+ return deprecatedLogs().rotate();
}
} // ripple
diff --git a/src/ripple/module/rpc/handlers/Profile.cpp b/src/ripple/module/rpc/handlers/Profile.cpp
index b7099e159..5b569dd6c 100644
--- a/src/ripple/module/rpc/handlers/Profile.cpp
+++ b/src/ripple/module/rpc/handlers/Profile.cpp
@@ -60,8 +60,6 @@ Json::Value doProfile (RPC::Context& context)
if (iArgs >= 8 && "false" != context.params_[7u].asString())
bSubmit = true;
- LogSink::get()->setMinSeverity(lsFATAL,true);
-
boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time());
for(unsigned int n=0; nhaveAuthorizedKey () && (asSrc->getAuthorizedKey ().getAccountID () != naAccountPublic.getAccountID ()))
{
- // Log::out() << "iIndex: " << iIndex;
- // Log::out() << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID());
- // Log::out() << "naAccountPublic: " << strHex(naAccountPublic.getAccountID());
-
return rpcError (rpcPASSWD_CHANGED);
}
diff --git a/src/ripple/module/rpc/impl/RPCHandler.cpp b/src/ripple/module/rpc/impl/RPCHandler.cpp
index fe4af9091..7a222023b 100644
--- a/src/ripple/module/rpc/impl/RPCHandler.cpp
+++ b/src/ripple/module/rpc/impl/RPCHandler.cpp
@@ -30,8 +30,6 @@ namespace ripple {
// Carries out the RPC.
//
-SETUP_LOG (RPCHandler)
-
RPCHandler::RPCHandler (NetworkOPs& netOps)
: mNetOps (&netOps)
, mRole (Config::FORBID)
diff --git a/src/ripple/module/rpc/impl/RPCServerHandler.cpp b/src/ripple/module/rpc/impl/RPCServerHandler.cpp
index ffdbd22dc..d7f754fb6 100644
--- a/src/ripple/module/rpc/impl/RPCServerHandler.cpp
+++ b/src/ripple/module/rpc/impl/RPCServerHandler.cpp
@@ -127,7 +127,7 @@ std::string RPCServerHandler::processRequest (std::string const& request,
return HTTPReply (400, "params must be an object");
ripple_params ["command"] = strMethod;
- RPC::Request req (LogPartition::getJournal (),
+ RPC::Request req (deprecatedLogs().journal("RPCServer"),
strMethod, ripple_params, getApp ());
// VFALCO Try processing the command using the new code
diff --git a/src/ripple/module/websocket/autosocket/AutoSocket.cpp b/src/ripple/module/websocket/autosocket/AutoSocket.cpp
index 25db6aee6..b52889995 100644
--- a/src/ripple/module/websocket/autosocket/AutoSocket.cpp
+++ b/src/ripple/module/websocket/autosocket/AutoSocket.cpp
@@ -17,4 +17,4 @@
*/
//==============================================================================
-ripple::LogPartition AutoSocket::AutoSocketPartition ("AutoSocket");
+// VFALCO - Empty file?
diff --git a/src/ripple/module/websocket/autosocket/AutoSocket.h b/src/ripple/module/websocket/autosocket/AutoSocket.h
index f1830127c..9f3fde9e8 100644
--- a/src/ripple/module/websocket/autosocket/AutoSocket.h
+++ b/src/ripple/module/websocket/autosocket/AutoSocket.h
@@ -106,8 +106,9 @@ public:
if (boost::asio::ssl::rfc2818_verification (domain) (preverified, ctx))
return true;
- Log (lsWARNING, AutoSocketPartition) << "Outbound SSL connection to " <<
- domain << " fails certificate verification";
+ WriteLog (lsWARNING, AutoSocket) <<
+ "Outbound SSL connection to " << domain <<
+ " fails certificate verification";
return false;
}
@@ -274,7 +275,8 @@ protected:
if (ec)
{
- Log (lsWARNING, AutoSocketPartition) << "Handle autodetect error: " << ec;
+ WriteLog (lsWARNING, AutoSocket) <<
+ "Handle autodetect error: " << ec;
cbFunc (ec);
}
else if ((mBuffer[0] < 127) && (mBuffer[0] > 31) &&
@@ -283,25 +285,20 @@ protected:
((bytesTransferred < 4) || ((mBuffer[3] < 127) && (mBuffer[3] > 31))))
{
// not ssl
- if (AutoSocketPartition.doLog (lsTRACE))
- Log (lsTRACE, AutoSocketPartition) << "non-SSL";
-
+ WriteLog (lsTRACE, AutoSocket) << "non-SSL";
mSecure = false;
cbFunc (ec);
}
else
{
// ssl
- if (AutoSocketPartition.doLog (lsTRACE))
- Log (lsTRACE, AutoSocketPartition) << "SSL";
-
+ WriteLog (lsTRACE, AutoSocket) << "SSL";
mSecure = true;
mSocket->async_handshake (ssl_socket::server, cbFunc);
}
}
private:
- static ripple::LogPartition AutoSocketPartition;
socket_ptr mSocket;
bool mSecure;
std::vector mBuffer;
diff --git a/src/ripple/module/websocket/autosocket/LogWebsockets.cpp b/src/ripple/module/websocket/autosocket/LogWebsockets.cpp
index d30193a2b..54d7f2009 100644
--- a/src/ripple/module/websocket/autosocket/LogWebsockets.cpp
+++ b/src/ripple/module/websocket/autosocket/LogWebsockets.cpp
@@ -20,12 +20,8 @@
// VFALCO NOTE this looks like some facility for giving websocket
// a way to produce logging output.
//
-namespace websocketpp
-{
-namespace log
-{
-
-ripple::LogPartition websocketPartition ("WebSocket");
+namespace websocketpp {
+namespace log {
void websocketLog (websocketpp::log::alevel::value v, const std::string& entry)
{
@@ -33,11 +29,12 @@ void websocketLog (websocketpp::log::alevel::value v, const std::string& entry)
if ((v == websocketpp::log::alevel::DEVEL) || (v == websocketpp::log::alevel::DEBUG_CLOSE))
{
- if (websocketPartition.doLog (lsTRACE))
- Log (lsDEBUG, websocketPartition) << entry;
+ WriteLog(lsTRACE, WebSocket) << entry;
+ }
+ else
+ {
+ WriteLog(lsDEBUG, WebSocket) << entry;
}
- else if (websocketPartition.doLog (lsDEBUG))
- Log (lsDEBUG, websocketPartition) << entry;
}
void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
@@ -55,8 +52,7 @@ void websocketLog (websocketpp::log::elevel::value v, const std::string& entry)
else if ((v & websocketpp::log::elevel::WARN) != 0)
s = lsWARNING;
- if (websocketPartition.doLog (s))
- Log (s, websocketPartition) << entry;
+ WriteLog(s, WebSocket) << entry;
}
}
diff --git a/src/ripple/nodestore/Manager.h b/src/ripple/nodestore/Manager.h
index 95baf635b..e4079dc14 100644
--- a/src/ripple/nodestore/Manager.h
+++ b/src/ripple/nodestore/Manager.h
@@ -23,17 +23,7 @@
namespace ripple {
namespace NodeStore {
-/** Singleton for managing NodeStore factories and back ends.
- Create a Manager like this:
- @code
- NodeStore::DummyScheduler scheduler;
- std::unique_ptr m (NodeStore::make_Manager());
-
- std::unique_ptr nodeStore (m->make_Database ("nodeStore",
- scheduler, LogPartition::getJournal (), 4,
- getConfig ().nodeDatabase));
- @endcode
-*/
+/** Singleton for managing NodeStore factories and back ends. */
class Manager
{
public:
diff --git a/src/ripple/nodestore/impl/DatabaseImp.h b/src/ripple/nodestore/impl/DatabaseImp.h
index 705b2e421..f69a646f4 100644
--- a/src/ripple/nodestore/impl/DatabaseImp.h
+++ b/src/ripple/nodestore/impl/DatabaseImp.h
@@ -20,9 +20,9 @@
#ifndef RIPPLE_NODESTORE_DATABASEIMP_H_INCLUDED
#define RIPPLE_NODESTORE_DATABASEIMP_H_INCLUDED
-#include
-#include
#include
+#include
+#include
#include
#include
#include
@@ -69,7 +69,7 @@ public:
, m_backend (std::move (backend))
, m_fastBackend (std::move (fastBackend))
, m_cache ("NodeStore", cacheTargetSize, cacheTargetSeconds,
- get_seconds_clock (), LogPartition::getJournal ())
+ get_seconds_clock (), deprecatedLogs().journal("TaggedCache"))
, m_negCache ("NodeStore", get_seconds_clock (),
cacheTargetSize, cacheTargetSeconds)
, m_readShut (false)
diff --git a/src/ripple/nodestore/impl/NodeObject.cpp b/src/ripple/nodestore/impl/NodeObject.cpp
index 6d5a90ae5..360789302 100644
--- a/src/ripple/nodestore/impl/NodeObject.cpp
+++ b/src/ripple/nodestore/impl/NodeObject.cpp
@@ -19,8 +19,6 @@
namespace ripple {
-SETUP_LOG (NodeObject)
-
//------------------------------------------------------------------------------
NodeObject::NodeObject (
diff --git a/src/ripple/overlay/impl/Message.cpp b/src/ripple/overlay/impl/Message.cpp
index 90e40bce8..851ecf440 100644
--- a/src/ripple/overlay/impl/Message.cpp
+++ b/src/ripple/overlay/impl/Message.cpp
@@ -36,10 +36,6 @@ Message::Message (::google::protobuf::Message const& message, int type)
if (messageBytes != 0)
{
message.SerializeToArray (&mBuffer [Message::kHeaderBytes], messageBytes);
-
-#ifdef BEAST_DEBUG
- //Log::out() << "Message: type=" << type << ", datalen=" << msg_size;
-#endif
}
}
diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp
index 403fe70d4..6eba83712 100644
--- a/src/ripple/overlay/impl/OverlayImpl.cpp
+++ b/src/ripple/overlay/impl/OverlayImpl.cpp
@@ -29,35 +29,6 @@
namespace ripple {
-SETUP_LOG (Peer)
-
-class PeersLog;
-template <> char const* LogPartition::getPartitionName () { return "Overlay"; }
-
-class PeerFinderLog;
-template <> char const* LogPartition::getPartitionName () { return "PeerFinder"; }
-
-class NameResolverLog;
-template <> char const* LogPartition::getPartitionName () { return "NameResolver"; }
-
-/** Calls a function during static initialization. */
-struct static_call
-{
- // Function must be callable as
- // void f (void) const
- //
- template
- static_call (Function const& f)
- {
- f ();
- }
-};
-
-static static_call init_PeerFinderLog (&LogPartition::get );
-static static_call init_NameResolverLog (&LogPartition::get );
-
-//------------------------------------------------------------------------------
-
/** A functor to visit all active peers and retrieve their JSON data */
struct get_peer_json
{
@@ -90,7 +61,7 @@ OverlayImpl::OverlayImpl (Stoppable& parent,
boost::asio::ssl::context& ssl_context)
: Overlay (parent)
, m_child_count (1)
- , m_journal (LogPartition::getJournal ())
+ , m_journal (deprecatedLogs().journal("Overlay"))
, m_resourceManager (resourceManager)
, m_peerFinder (add (PeerFinder::Manager::New (
*this,
@@ -98,7 +69,7 @@ OverlayImpl::OverlayImpl (Stoppable& parent,
pathToDbFileOrDirectory,
*this,
get_seconds_clock (),
- LogPartition::getJournal ())))
+ deprecatedLogs().journal("PeerFinder"))))
, m_io_service (io_service)
, m_ssl_context (ssl_context)
, m_resolver (resolver)
diff --git a/src/ripple/overlay/impl/PeerDoor.cpp b/src/ripple/overlay/impl/PeerDoor.cpp
index ed95606e8..2f50a0b06 100644
--- a/src/ripple/overlay/impl/PeerDoor.cpp
+++ b/src/ripple/overlay/impl/PeerDoor.cpp
@@ -23,8 +23,6 @@
namespace ripple {
-SETUP_LOG (PeerDoor)
-
class PeerDoorImp
: public PeerDoor
, public beast::LeakChecked
@@ -42,7 +40,7 @@ public:
boost::asio::ip::tcp::endpoint const &ep,
boost::asio::io_service& io_service)
: m_overlay (overlay)
- , m_journal (LogPartition::getJournal ())
+ , m_journal (deprecatedLogs().journal("PeerDoor"))
, m_kind (kind)
, m_acceptor (io_service, ep)
, m_acceptDelay (io_service)
diff --git a/src/ripple/overlay/impl/PeerImp.h b/src/ripple/overlay/impl/PeerImp.h
index 1573fbd94..db1b07b4a 100644
--- a/src/ripple/overlay/impl/PeerImp.h
+++ b/src/ripple/overlay/impl/PeerImp.h
@@ -231,7 +231,7 @@ public:
boost::asio::ssl::context& ssl_context,
MultiSocket::Flag flags)
: m_owned_socket (std::move (socket))
- , m_journal (LogPartition::getJournal ())
+ , m_journal (deprecatedLogs().journal("Peer"))
, m_shortId (0)
, m_remoteAddress (remoteAddress)
, m_resourceManager (resourceManager)
@@ -269,7 +269,7 @@ public:
boost::asio::ssl::context& ssl_context,
MultiSocket::Flag flags)
: m_owned_socket (io_service)
- , m_journal (LogPartition::getJournal ())
+ , m_journal (deprecatedLogs().journal("Peer"))
, m_shortId (0)
, m_remoteAddress (remoteAddress)
, m_resourceManager (resourceManager)
diff --git a/src/ripple/unity/basics.cpp b/src/ripple/unity/basics.cpp
index 5a38d6de0..92f0708d2 100644
--- a/src/ripple/unity/basics.cpp
+++ b/src/ripple/unity/basics.cpp
@@ -21,9 +21,6 @@
#include
#include
-#include
-#include
-#include
#include
#include
#include
diff --git a/src/ripple/unity/basics.h b/src/ripple/unity/basics.h
index def0e814f..41d600e49 100644
--- a/src/ripple/unity/basics.h
+++ b/src/ripple/unity/basics.h
@@ -36,10 +36,6 @@ using beast::Zero;
#include
-#include
-#include
-#include
-#include
#include
#include
#include