diff --git a/libdevcore/Log.cpp b/libdevcore/Log.cpp index cad77cb3f..f64f682c3 100644 --- a/libdevcore/Log.cpp +++ b/libdevcore/Log.cpp @@ -130,11 +130,6 @@ string dev::ThreadContext::join(string const& _prior) return g_logThreadContext.join(_prior); } -// foward declare without all of Windows.h -#ifdef _WIN32 -extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* lpOutputString); -#endif - string dev::getThreadName() { #if defined(__linux__) || defined(__APPLE__) @@ -158,20 +153,7 @@ void dev::setThreadName(char const* _n) #endif } -void dev::simpleDebugOut(std::string const& _s, char const*) +void dev::simpleDebugOut(std::string const& _s) { - static SpinLock s_lock; - SpinGuard l(s_lock); - - cerr << _s << endl << flush; - - // helpful to use OutputDebugString on windows - #ifdef _WIN32 - { - OutputDebugStringA(_s.data()); - OutputDebugStringA("\n"); - } - #endif + std::cerr << _s << '\n'; } - -std::function dev::g_logPost = simpleDebugOut; diff --git a/libdevcore/Log.h b/libdevcore/Log.h index d6e2ef44d..8d8c2b3bc 100644 --- a/libdevcore/Log.h +++ b/libdevcore/Log.h @@ -44,14 +44,11 @@ public: }; /// A simple log-output function that prints log messages to stdout. -void simpleDebugOut(std::string const&, char const*); +void simpleDebugOut(std::string const&); /// The logging system's current verbosity. extern int g_logVerbosity; -/// The current method that the logging system uses to output the log messages. Defaults to simpleDebugOut(). -extern std::function g_logPost; - class ThreadContext { public: @@ -208,7 +205,7 @@ public: LogOutputStream(): LogOutputStreamBase(Id::name(), &typeid(Id), Id::verbosity, _AutoSpacing) {} /// Destructor. Posts the accrued log entry to the g_logPost function. - ~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) g_logPost(m_sstr.str(), Id::name()); } + ~LogOutputStream() { if (Id::verbosity <= g_logVerbosity) simpleDebugOut(m_sstr.str()); } LogOutputStream& operator<<(std::string const& _t) { if (Id::verbosity <= g_logVerbosity) { if (_AutoSpacing && m_sstr.str().size() && m_sstr.str().back() != ' ') m_sstr << " "; comment(_t); } return *this; }