# HG changeset patch # User Sebastien Jodogne # Date 1522052060 -7200 # Node ID fe86687b07a584ecd1fa2b56af17a4bab459c458 # Parent 55e9dde3faee21394f710a1b66bcc46a3fc6beb7 sync diff -r 55e9dde3faee -r fe86687b07a5 Resources/Orthanc/Core/Logging.h --- a/Resources/Orthanc/Core/Logging.h Sat Mar 24 12:03:18 2018 +0100 +++ b/Resources/Orthanc/Core/Logging.h Mon Mar 26 10:14:20 2018 +0200 @@ -59,6 +59,8 @@ # include #endif +#include + namespace Orthanc { namespace Logging @@ -91,13 +93,8 @@ { } - std::ostream& operator<< (const std::string& message) - { - return *this; - } - - // This overload fixes build problems with Visual Studio 2015 - std::ostream& operator<< (const char* message) + template + std::ostream& operator<< (const T& message) { return *this; } @@ -116,7 +113,6 @@ ORTHANC_ENABLE_LOGGING_STDIO == 1) # include -# include # define LOG(level) ::Orthanc::Logging::InternalLogger \ (::Orthanc::Logging::level, __FILE__, __LINE__) # define VLOG(level) ::Orthanc::Logging::InternalLogger \ @@ -148,7 +144,7 @@ ~InternalLogger(); template - InternalLogger& operator<< (T message) + InternalLogger& operator<< (const T& message) { message_ += boost::lexical_cast(message); return *this; @@ -186,15 +182,10 @@ ~InternalLogger(); - std::ostream& operator<< (const std::string& message) + template + std::ostream& operator<< (const T& message) { - return (*stream_) << message; - } - - // This overload fixes build problems with Visual Studio 2015 - std::ostream& operator<< (const char* message) - { - return (*stream_) << message; + return (*stream_) << boost::lexical_cast(message); } }; }