changeset 4008:2d4427ca4be9

removed Core/LoggingUtils.h
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Jun 2020 08:47:43 +0200
parents 884b55ce01f6
children 16978ee28588
files Core/LoggingUtils.h UnitTestsSources/LoggingTests.cpp
diffstat 2 files changed, 30 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Core/LoggingUtils.h	Sat Jun 06 14:50:21 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#include <sstream>
-#include <iostream>
-
-namespace Orthanc
-{
-  namespace Logging
-  {
-
-    /**
-      std::streambuf subclass used in FunctionCallingStream
-    */
-    template<typename T>
-    class FuncStreamBuf : public std::stringbuf
-    {
-    public:
-      FuncStreamBuf(T func) : func_(func) {}
-
-      virtual int sync()
-      {
-        std::string text = this->str();
-        const char* buf = text.c_str();
-        func_(buf);
-        this->str("");
-        return 0;
-      }
-    private:
-      T func_;
-    };
-  }
-}
\ No newline at end of file
--- a/UnitTestsSources/LoggingTests.cpp	Sat Jun 06 14:50:21 2020 +0200
+++ b/UnitTestsSources/LoggingTests.cpp	Mon Jun 08 08:47:43 2020 +0200
@@ -41,7 +41,6 @@
 #include <sstream>
 
 #include "../Core/Logging.h"
-#include "../Core/LoggingUtils.h"
 
 using namespace Orthanc::Logging;
 
@@ -64,19 +63,19 @@
 }
 
 /**
-Extracts the log line payload
+   Extracts the log line payload
 
-"E0423 16:55:43.001194 LoggingTests.cpp:102] Foo bar?\n"
--->
-"Foo bar"
+   "E0423 16:55:43.001194 LoggingTests.cpp:102] Foo bar?\n"
+   -->
+   "Foo bar"
 
-If the log line cannot be matched, the function returns false.
+   If the log line cannot be matched, the function returns false.
 */
 
 #define EOLSTRING "\n"
 
 static bool GetLogLinePayload(std::string& payload,
-  const std::string& logLine)
+                              const std::string& logLine)
 {
   const char* regexStr = "[A-Z][0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{6} "
     "[a-zA-Z\\.\\-_]+:[0-9]+\\] (.*)" EOLSTRING "$";
@@ -100,6 +99,7 @@
   }
 }
 
+
 namespace
 {
   class LoggingMementoScope
@@ -114,8 +114,31 @@
       Orthanc::Logging::Reset();
     }
   };
+
+
+  /**
+   * std::streambuf subclass used in FunctionCallingStream
+   **/
+  template<typename T>
+  class FuncStreamBuf : public std::stringbuf
+  {
+  public:
+    FuncStreamBuf(T func) : func_(func) {}
+
+    virtual int sync()
+    {
+      std::string text = this->str();
+      const char* buf = text.c_str();
+      func_(buf);
+      this->str("");
+      return 0;
+    }
+  private:
+    T func_;
+  };
 }
 
+
 TEST(FuncStreamBuf, BasicTest)
 {
   LoggingMementoScope loggingConfiguration;