Paweł Bylica
8 years ago
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
2 changed files with
4 additions and
25 deletions
-
libdevcore/Log.cpp
-
libdevcore/Log.h
|
|
@ -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<void(std::string const&, char const*)> dev::g_logPost = simpleDebugOut; |
|
|
|
|
|
@ -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<void(std::string const&, char const*)> 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; } |
|
|
|
|
|
|
|