# HG changeset patch
# User Sebastien Jodogne <s.jodogne@gmail.com>
# Date 1520011507 -3600
# Node ID 911e62dbb4ac3d2ea16cb7a0e96d58fadacac075
# Parent  9c54c40eaf25a4cf4d8bd464ce522c65162b146c
logging to stdio

diff -r 9c54c40eaf25 -r 911e62dbb4ac Core/Logging.cpp
--- a/Core/Logging.cpp	Fri Mar 02 15:10:37 2018 +0100
+++ b/Core/Logging.cpp	Fri Mar 02 18:25:07 2018 +0100
@@ -133,24 +133,6 @@
         }
       }
     }
-
-    InternalLogger& InternalLogger::operator<< (const std::string& message)
-    {
-      message_ += message;
-      return *this;
-    }
-
-    InternalLogger& InternalLogger::operator<< (const char* message)
-    {
-      message_ += std::string(message);
-      return *this;
-    }
-
-    InternalLogger& InternalLogger::operator<< (int message)
-    {
-      message_ += boost::lexical_cast<std::string>(message);
-      return *this;
-    }
   }
 }
 
@@ -209,24 +191,6 @@
       }
     }
 
-    InternalLogger& InternalLogger::operator<< (const std::string& message)
-    {
-      message_ += message;
-      return *this;
-    }
-
-    InternalLogger& InternalLogger::operator<< (const char* message)
-    {
-      message_ += std::string(message);
-      return *this;
-    }
-
-    InternalLogger& InternalLogger::operator<< (int message)
-    {
-      message_ += boost::lexical_cast<std::string>(message);
-      return *this;
-    }
-
     void EnableInfoLevel(bool enabled)
     {
       globalVerbose_ = enabled;
diff -r 9c54c40eaf25 -r 911e62dbb4ac Core/Logging.h
--- a/Core/Logging.h	Fri Mar 02 15:10:37 2018 +0100
+++ b/Core/Logging.h	Fri Mar 02 18:25:07 2018 +0100
@@ -116,6 +116,7 @@
        ORTHANC_ENABLE_LOGGING_STDIO == 1)
 
 #  include <boost/noncopyable.hpp>
+#  include <boost/lexical_cast.hpp>
 #  define LOG(level)  ::Orthanc::Logging::InternalLogger \
   (::Orthanc::Logging::level, __FILE__, __LINE__)
 #  define VLOG(level) ::Orthanc::Logging::InternalLogger \
@@ -146,11 +147,12 @@
 
       ~InternalLogger();
       
-      InternalLogger& operator<< (const std::string& message);
-
-      InternalLogger& operator<< (const char* message);
-
-      InternalLogger& operator<< (int message);
+      template <typename T>
+      InternalLogger& operator<< (T message)
+      {
+        message_ += boost::lexical_cast<std::string>(message);
+        return *this;
+      }
     };
   }
 }