changeset 4010:f0ee3f1db775

removed unused Logging::SetErrorWarnInfoTraceLoggingFunctions()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Jun 2020 15:54:30 +0200
parents 16978ee28588
children dc6e7c7372ae
files Core/Logging.cpp Core/Logging.h
diffstat 2 files changed, 11 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Logging.cpp	Mon Jun 08 09:02:08 2020 +0200
+++ b/Core/Logging.cpp	Mon Jun 08 15:54:30 2020 +0200
@@ -164,65 +164,49 @@
     static bool globalTrace_ = false;
     
 #ifdef __EMSCRIPTEN__
-    static void defaultErrorLogFunc(const char* msg)
+    static void ErrorLogFunc(const char* msg)
     {
       emscripten_console_error(msg);
     }
 
-    static void defaultWarningLogFunc(const char* msg)
+    static void WarningLogFunc(const char* msg)
     {
       emscripten_console_warn(msg);
     }
 
-    static void defaultInfoLogFunc(const char* msg)
+    static void InfoLogFunc(const char* msg)
     {
       emscripten_console_log(msg);
     }
 
-    static void defaultTraceLogFunc(const char* msg)
+    static void TraceLogFunc(const char* msg)
     {
       emscripten_console_log(msg);
     }
 #else
 // __EMSCRIPTEN__ not #defined
-    static void defaultErrorLogFunc(const char* msg)
+    static void ErrorLogFunc(const char* msg)
     {
       fprintf(stderr, "E: %s\n", msg);
     }
 
-    static void defaultWarningLogFunc(const char*)
+    static void WarningLogFunc(const char*)
     {
       fprintf(stdout, "W: %s\n", msg);
     }
 
-    static void defaultInfoLogFunc(const char*)
+    static void InfoLogFunc(const char*)
     {
       fprintf(stdout, "I: %s\n", msg);
     }
 
-    static void defaultTraceLogFunc(const char*)
+    static void TraceLogFunc(const char*)
     {
       fprintf(stdout, "T: %s\n", msg);
     }
 #endif 
 // __EMSCRIPTEN__
 
-    static LoggingFunction globalErrorLogFunc = defaultErrorLogFunc;
-    static LoggingFunction globalWarningLogFunc = defaultWarningLogFunc;
-    static LoggingFunction globalInfoLogFunc = defaultInfoLogFunc;
-    static LoggingFunction globalTraceLogFunc = defaultTraceLogFunc;
-
-    void SetErrorWarnInfoTraceLoggingFunctions(LoggingFunction errorLogFunc,
-                                               LoggingFunction warningLogfunc,
-                                               LoggingFunction infoLogFunc,
-                                               LoggingFunction traceLogFunc)
-    {
-      globalErrorLogFunc = errorLogFunc;
-      globalWarningLogFunc = warningLogfunc;
-      globalInfoLogFunc = infoLogFunc;
-      globalTraceLogFunc = traceLogFunc;
-    }
-
     InternalLogger::InternalLogger(LogLevel level,
                                    const char* file  /* ignored */,
                                    int line  /* ignored */) :
@@ -739,9 +723,11 @@
     InternalLogger::InternalLogger(LogLevel level,
                                    const char* file,
                                    int line) : 
-      lock_(loggingMutex_), 
+      lock_(loggingMutex_, boost::defer_lock_t()), 
       stream_(&null_)  // By default, logging to "/dev/null" is simulated
     {
+      lock_.lock();
+      
       if (loggingContext_.get() == NULL)
       {
         fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine\n");
--- a/Core/Logging.h	Mon Jun 08 09:02:08 2020 +0200
+++ b/Core/Logging.h	Mon Jun 08 15:54:30 2020 +0200
@@ -101,14 +101,6 @@
 
     ORTHANC_PUBLIC void SetTargetFolder(const std::string& path);
 
-#if ORTHANC_ENABLE_LOGGING_STDIO == 1
-    typedef void (*LoggingFunction)(const char*);
-    ORTHANC_PUBLIC void SetErrorWarnInfoTraceLoggingFunctions(LoggingFunction errorLogFunc,
-                                                              LoggingFunction warningLogfunc,
-                                                              LoggingFunction infoLogFunc,
-                                                              LoggingFunction traceLogFunc);
-#endif
-
     struct NullStream : public std::ostream 
     {
       NullStream() :