diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index 7f2e499ecd..97e738b2a2 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -3759,9 +3759,6 @@ - - True - True diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 72439a7394..bdc5070e59 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -4239,9 +4239,6 @@ ripple\websocket - - ripple\websocket - ripple\websocket diff --git a/src/ripple/app/main/Main.cpp b/src/ripple/app/main/Main.cpp index 6c64c2baa9..dbd8c9219d 100644 --- a/src/ripple/app/main/Main.cpp +++ b/src/ripple/app/main/Main.cpp @@ -419,18 +419,19 @@ int run (int argc, char** argv) } } + // Construct the logs object at the configured severity + beast::Journal::Severity thresh = beast::Journal::kInfo; + + if (vm.count ("quiet")) + thresh = beast::Journal::kFatal; + else if (vm.count ("verbose")) + thresh = beast::Journal::kTrace; + + auto logs = std::make_unique(thresh); + // No arguments. Run server. if (!vm.count ("parameters")) { - auto logs = std::make_unique(); - - if (vm.count ("quiet")) - logs->threshold (beast::Journal::kFatal); - else if (vm.count ("verbose")) - logs->threshold (beast::Journal::kTrace); - else - logs->threshold (beast::Journal::kInfo); - if (vm.count ("debug")) setDebugJournalSink (logs->get("Debug")); @@ -450,7 +451,8 @@ int run (int argc, char** argv) setCallingThreadName ("rpc"); return RPCCall::fromCommandLine ( *config, - vm["parameters"].as>(), deprecatedLogs()); + vm["parameters"].as>(), + *logs); } extern int run (int argc, char** argv); diff --git a/src/ripple/basics/Log.h b/src/ripple/basics/Log.h index 0a5a7d34e1..3608979497 100644 --- a/src/ripple/basics/Log.h +++ b/src/ripple/basics/Log.h @@ -154,7 +154,7 @@ private: bool silent_ = false; public: - Logs(); + Logs(beast::Journal::Severity level); Logs (Logs const&) = delete; Logs& operator= (Logs const&) = delete; @@ -262,35 +262,6 @@ debugJournal(); void setDebugJournalSink(beast::Journal::Sink& sink); -//------------------------------------------------------------------------------ -// VFALCO DEPRECATED Temporary transition function until interfaces injected -inline -Logs& -deprecatedLogs() -{ - static Logs logs; - return logs; -} - -class LogSquelcher -{ -public: - LogSquelcher() - : thresh_(deprecatedLogs().threshold()) - { - deprecatedLogs().threshold( - beast::Journal::Severity::kNone); - } - - ~LogSquelcher() - { - deprecatedLogs().threshold(thresh_); - } - -private: - beast::Journal::Severity const thresh_; -}; - } // ripple #endif diff --git a/src/ripple/basics/impl/Log.cpp b/src/ripple/basics/impl/Log.cpp index fd6252c595..1e5d68243b 100644 --- a/src/ripple/basics/impl/Log.cpp +++ b/src/ripple/basics/impl/Log.cpp @@ -111,8 +111,8 @@ void Logs::File::writeln (char const* text) //------------------------------------------------------------------------------ -Logs::Logs() - : thresh_ (beast::Journal::kWarning) // default severity +Logs::Logs(beast::Journal::Severity thresh) + : thresh_ (thresh) // default severity { } diff --git a/src/ripple/ledger/tests/SkipList_test.cpp b/src/ripple/ledger/tests/SkipList_test.cpp index f921330dd6..2a99edff72 100644 --- a/src/ripple/ledger/tests/SkipList_test.cpp +++ b/src/ripple/ledger/tests/SkipList_test.cpp @@ -104,7 +104,6 @@ class SkipList_test : public beast::unit_test::suite void run() { - LogSquelcher l; testSkipList(); } }; diff --git a/src/ripple/net/impl/HTTPClient.cpp b/src/ripple/net/impl/HTTPClient.cpp index 7ea789cf55..fcb9ac1d7f 100644 --- a/src/ripple/net/impl/HTTPClient.cpp +++ b/src/ripple/net/impl/HTTPClient.cpp @@ -106,7 +106,7 @@ public: const unsigned short port, std::size_t responseMax, Logs& l) - : mSocket (io_service, httpClientSSLContext->context (), l.journal ("AutoSocket")) + : mSocket (io_service, httpClientSSLContext->context ()) , mResolver (io_service) , mHeader (maxClientHeaderBytes) , mPort (port) diff --git a/src/ripple/rpc/handlers/RipplePathFind.cpp b/src/ripple/rpc/handlers/RipplePathFind.cpp index 14db256c62..2ddf3dae5c 100644 --- a/src/ripple/rpc/handlers/RipplePathFind.cpp +++ b/src/ripple/rpc/handlers/RipplePathFind.cpp @@ -406,7 +406,7 @@ ripplePathFind (std::shared_ptr const& cache, app.logs(), &rcInput); - JLOG(j.warning) + JLOG(j.info) << "ripple_path_find:" << " saMaxAmount=" << saMaxAmount << " saDstAmount=" << saDstAmount diff --git a/src/ripple/test/jtx/Env.h b/src/ripple/test/jtx/Env.h index ce5554ec63..d99acfd9b6 100644 --- a/src/ripple/test/jtx/Env.h +++ b/src/ripple/test/jtx/Env.h @@ -109,7 +109,6 @@ private: }; AppBundle bundle_; - LogSquelcher logSquelcher_; inline void diff --git a/src/ripple/test/jtx/impl/Env.cpp b/src/ripple/test/jtx/impl/Env.cpp index 9a8a8e1fca..a2ee4c70dd 100644 --- a/src/ripple/test/jtx/impl/Env.cpp +++ b/src/ripple/test/jtx/impl/Env.cpp @@ -135,7 +135,8 @@ class SuiteLogs : public Logs public: explicit SuiteLogs(beast::unit_test::suite& suite) - : suite_(suite) + : Logs (beast::Journal::kError) + , suite_(suite) { } diff --git a/src/ripple/unity/websocket02.cpp b/src/ripple/unity/websocket02.cpp index 7beeaf9865..7cc09088ad 100644 --- a/src/ripple/unity/websocket02.cpp +++ b/src/ripple/unity/websocket02.cpp @@ -41,7 +41,6 @@ #include #include -#include // Must come last to prevent compilation errors. #include diff --git a/src/ripple/websocket/AutoSocket.h b/src/ripple/websocket/AutoSocket.h index e390cf5231..3c13accddb 100644 --- a/src/ripple/websocket/AutoSocket.h +++ b/src/ripple/websocket/AutoSocket.h @@ -46,31 +46,24 @@ public: using callback = std::function ; public: - AutoSocket (boost::asio::io_service& s, boost::asio::ssl::context& c, beast::Journal j) - : mSecure (false) - , mBuffer (4) - , j_ (j) - { - mSocket = std::make_shared (s, c); - } - AutoSocket ( - boost::asio::io_service& s, boost::asio::ssl::context& c, - bool secureOnly, bool plainOnly, beast::Journal j) + boost::asio::io_service& s, + boost::asio::ssl::context& c, + bool secureOnly, + bool plainOnly) : mSecure (secureOnly) , mBuffer ((plainOnly || secureOnly) ? 0 : 4) - , j_ (j) + , j_ (ripple::debugJournal()) { mSocket = std::make_shared (s, c); } - // swd TBD try remove this constructor - // This needs to use `deprecatedLogs` or a change is needed - // in websocket_02 (which breaks leveling) AutoSocket ( - boost::asio::io_service& s, boost::asio::ssl::context& c, - bool secureOnly, bool plainOnly) - : AutoSocket (s, c, secureOnly, plainOnly, ripple::deprecatedLogs().journal ("AutoSocket")){} + boost::asio::io_service& s, + boost::asio::ssl::context& c) + : AutoSocket (s, c, false, false) + { + } boost::asio::io_service& get_io_service () noexcept { diff --git a/src/ripple/websocket/LogWebsockets.cpp b/src/ripple/websocket/LogWebsockets.cpp deleted file mode 100644 index 119ede18b3..0000000000 --- a/src/ripple/websocket/LogWebsockets.cpp +++ /dev/null @@ -1,61 +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. -*/ -//============================================================================== - -// VFALCO NOTE this looks like some facility for giving websocket -// a way to produce logging output. -// -namespace websocketpp_02 { -namespace log { - -void websocketLog ( - websocketpp_02::log::alevel::value v, std::string const& entry) -{ - auto const isTrace = - v == websocketpp_02::log::alevel::DEVEL || - v == websocketpp_02::log::alevel::DEBUG_CLOSE; - - auto journal = ripple::debugJournal(); - - if (isTrace) - JLOG (journal.trace) << entry; - else - JLOG (journal.debug) << entry; -} - -void websocketLog ( - websocketpp_02::log::elevel::value v, std::string const& entry) -{ - auto journal = ripple::debugJournal(); - - if ((v & websocketpp_02::log::elevel::INFO) != 0) - JLOG (journal.info) << entry; - else if ((v & websocketpp_02::log::elevel::FATAL) != 0) - JLOG (journal.fatal) << entry; - else if ((v & websocketpp_02::log::elevel::RERROR) != 0) - JLOG (journal.error) << entry; - else if ((v & websocketpp_02::log::elevel::WARN) != 0) - JLOG (journal.warning) << entry; - else - JLOG (journal.debug) << entry; -} - -} -} - -// vim:ts=4 diff --git a/src/websocketpp_02/src/logger/logger.hpp b/src/websocketpp_02/src/logger/logger.hpp index 006841e01e..7d5e3cc546 100644 --- a/src/websocketpp_02/src/logger/logger.hpp +++ b/src/websocketpp_02/src/logger/logger.hpp @@ -85,9 +85,6 @@ namespace elevel { static const value ALL = 0xFFFF; } -extern void websocketLog(alevel::value, const std::string&); -extern void websocketLog(elevel::value, const std::string&); - template class logger { public: