changeset 4295:90f91b78d708

applied log categories
author Alain Mazy <alain@mazy.be>
date Thu, 05 Nov 2020 12:01:11 +0100
parents 0923247e69f6
children 3b70a2e6a06c
files OrthancFramework/Sources/HttpServer/HttpServer.cpp OrthancFramework/Sources/JobsEngine/JobsEngine.cpp OrthancServer/Sources/ServerJobs/LuaJobManager.cpp
diffstat 3 files changed, 45 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Thu Nov 05 11:43:32 2020 +0100
+++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp	Thu Nov 05 12:01:11 2020 +0100
@@ -634,7 +634,7 @@
       // A faking has been done within this request
       Toolbox::ToUpperCase(overriden);
 
-      LOG(INFO) << "HTTP method faking has been detected for " << overriden;
+      CLOG(INFO, HTTP) << "HTTP method faking has been detected for " << overriden;
 
       if (overriden == "PUT")
       {
@@ -712,7 +712,7 @@
   static void AnswerWebDavReadOnly(HttpOutput& output,
                                    const std::string& uri)
   {
-    LOG(ERROR) << "Orthanc was compiled without support for read-write access to WebDAV: " << uri;
+    CLOG(ERROR, HTTP) << "Orthanc was compiled without support for read-write access to WebDAV: " << uri;
     output.SendStatus(HttpStatus_403_Forbidden);
   }    
 #  endif
@@ -946,7 +946,7 @@
             }
             else
             {
-              LOG(ERROR) << "Cannot read the content of a file to be stored in WebDAV";
+              CLOG(ERROR, HTTP) << "Cannot read the content of a file to be stored in WebDAV";
               output.SendStatus(HttpStatus_400_BadRequest);
             }
 #else
@@ -1162,7 +1162,7 @@
     
     if (ExtractMethod(method, request, headers, argumentsGET))
     {
-      LOG(INFO) << EnumerationToString(method) << " " << Toolbox::FlattenUri(uri);
+      CLOG(INFO, HTTP) << EnumerationToString(method) << " " << Toolbox::FlattenUri(uri);
       filterMethod = method;
     }
 #if ORTHANC_ENABLE_PUGIXML == 1
@@ -1170,8 +1170,8 @@
              !strcmp(request->request_method, "PROPFIND") ||
              !strcmp(request->request_method, "HEAD"))
     {
-      LOG(INFO) << "Incoming read-only WebDAV request: "
-                << request->request_method << " " << requestUri;
+      CLOG(INFO, HTTP) << "Incoming read-only WebDAV request: "
+                       << request->request_method << " " << requestUri;
       filterMethod = HttpMethod_Get;
       isWebDav = true;
     }
@@ -1180,15 +1180,15 @@
              !strcmp(request->request_method, "UNLOCK") ||
              !strcmp(request->request_method, "MKCOL"))
     {
-      LOG(INFO) << "Incoming read-write WebDAV request: "
-                << request->request_method << " " << requestUri;
+      CLOG(INFO, HTTP) << "Incoming read-write WebDAV request: "
+                       << request->request_method << " " << requestUri;
       filterMethod = HttpMethod_Put;
       isWebDav = true;
     }
 #endif /* ORTHANC_ENABLE_PUGIXML == 1 */
     else
     {
-      LOG(INFO) << "Unknown HTTP method: " << request->request_method;
+      CLOG(INFO, HTTP) << "Unknown HTTP method: " << request->request_method;
       output.SendStatus(HttpStatus_400_BadRequest);
       return;
     }
@@ -1218,8 +1218,8 @@
     }
     else if (isWebDav)
     {
-      LOG(INFO) << "No WebDAV bucket is registered against URI: "
-                << request->request_method << " " << requestUri;
+      CLOG(INFO, HTTP) << "No WebDAV bucket is registered against URI: "
+                       << request->request_method << " " << requestUri;
       output.SendStatus(HttpStatus_404_NotFound);
       return;
     }
@@ -1401,7 +1401,7 @@
         {
           if (server->GetExceptionFormatter() == NULL)
           {
-            LOG(ERROR) << "Exception in the HTTP handler: " << e.What();
+            CLOG(ERROR, HTTP) << "Exception in the HTTP handler: " << e.What();
             output.SendStatus(e.GetHttpStatus());
           }
           else
@@ -1419,7 +1419,7 @@
     catch (...)
     {
       // We should never arrive at this point, where it is even impossible to send an answer
-      LOG(ERROR) << "Catastrophic error inside the HTTP server, giving up";
+      CLOG(ERROR, HTTP) << "Catastrophic error inside the HTTP server, giving up";
     }
   }
 
@@ -1484,11 +1484,11 @@
     requestTimeout_(30)  // Default value in mongoose/civetweb (30 seconds)    
   {
 #if ORTHANC_ENABLE_MONGOOSE == 1
-    LOG(INFO) << "This Orthanc server uses Mongoose as its embedded HTTP server";
+    CLOG(INFO, HTTP) << "This Orthanc server uses Mongoose as its embedded HTTP server";
 #endif
 
 #if ORTHANC_ENABLE_CIVETWEB == 1
-    LOG(INFO) << "This Orthanc server uses CivetWeb as its embedded HTTP server";
+    CLOG(INFO, HTTP) << "This Orthanc server uses CivetWeb as its embedded HTTP server";
 #endif
 
 #if ORTHANC_ENABLE_SSL == 1
@@ -1497,7 +1497,7 @@
     if (OPENSSL_VERSION_NUMBER <  0x1000107fL  /* openssl-1.0.1g */ &&
         OPENSSL_VERSION_NUMBER >= 0x1000100fL  /* openssl-1.0.1 */) 
     {
-      LOG(WARNING) << "This version of OpenSSL is vulnerable to the Heartbleed exploit";
+      CLOG(WARNING, HTTP) << "This version of OpenSSL is vulnerable to the Heartbleed exploit";
     }
 #endif
   }
@@ -1526,9 +1526,9 @@
   void HttpServer::Start()
   {
 #if ORTHANC_ENABLE_MONGOOSE == 1
-    LOG(INFO) << "Starting embedded Web server using Mongoose";
+    CLOG(INFO, HTTP) << "Starting embedded Web server using Mongoose";
 #elif ORTHANC_ENABLE_CIVETWEB == 1
-    LOG(INFO) << "Starting embedded Web server using Civetweb";
+    CLOG(INFO, HTTP) << "Starting embedded Web server using Civetweb";
 #else
 #  error
 #endif  
@@ -1629,7 +1629,7 @@
             isSslError = true;
             char message[1024];
             ERR_error_string_n(code, message, sizeof(message) - 1);
-            LOG(ERROR) << "OpenSSL error: " << message;
+            CLOG(ERROR, HTTP) << "OpenSSL error: " << message;
           }
         }        
 #endif
@@ -1653,12 +1653,12 @@
       }
 #endif
 
-      LOG(WARNING) << "HTTP server listening on port: " << GetPortNumber()
-                   << " (HTTPS encryption is "
-                   << (IsSslEnabled() ? "enabled" : "disabled")
-                   << ", remote access is "
-                   << (IsRemoteAccessAllowed() ? "" : "not ")
-                   << "allowed)";
+      CLOG(WARNING, HTTP) << "HTTP server listening on port: " << GetPortNumber()
+                          << " (HTTPS encryption is "
+                          << (IsSslEnabled() ? "enabled" : "disabled")
+                          << ", remote access is "
+                          << (IsRemoteAccessAllowed() ? "" : "not ")
+                          << "allowed)";
     }
   }
 
@@ -1739,12 +1739,12 @@
   {
     Stop();
     keepAlive_ = enabled;
-    LOG(INFO) << "HTTP keep alive is " << (enabled ? "enabled" : "disabled");
+    CLOG(INFO, HTTP) << "HTTP keep alive is " << (enabled ? "enabled" : "disabled");
 
 #if ORTHANC_ENABLE_MONGOOSE == 1
     if (enabled)
     {
-      LOG(WARNING) << "You should disable HTTP keep alive, as you are using Mongoose";
+      CLOG(WARNING, HTTP) << "You should disable HTTP keep alive, as you are using Mongoose";
     }
 #endif
   }
@@ -1778,7 +1778,7 @@
   {
     Stop();
     httpCompression_ = enabled;
-    LOG(WARNING) << "HTTP compression is " << (enabled ? "enabled" : "disabled");
+    CLOG(WARNING, HTTP) << "HTTP compression is " << (enabled ? "enabled" : "disabled");
   }
   
   void HttpServer::SetIncomingHttpRequestFilter(IIncomingHttpRequestFilter& filter)
@@ -1829,7 +1829,7 @@
     Stop();
     threadsCount_ = threads;
 
-    LOG(INFO) << "The embedded HTTP server will use " << threads << " threads";
+    CLOG(INFO, HTTP) << "The embedded HTTP server will use " << threads << " threads";
   }
 
   
@@ -1837,8 +1837,8 @@
   {
     Stop();
     tcpNoDelay_ = tcpNoDelay;
-    LOG(INFO) << "TCP_NODELAY for the HTTP sockets is set to "
-              << (tcpNoDelay ? "true" : "false");
+    CLOG(INFO, HTTP) << "TCP_NODELAY for the HTTP sockets is set to "
+                     << (tcpNoDelay ? "true" : "false");
   }
 
 
@@ -1852,7 +1852,7 @@
 
     Stop();
     requestTimeout_ = seconds;
-    LOG(INFO) << "Request timeout in the HTTP server is set to " << seconds << " seconds";
+    CLOG(INFO, HTTP) << "Request timeout in the HTTP server is set to " << seconds << " seconds";
   }
 
 
@@ -1872,8 +1872,8 @@
 #if CIVETWEB_HAS_WEBDAV_WRITING == 0
     if (webDavBuckets_.size() == 0)
     {
-      LOG(WARNING) << "Your version of the Orthanc framework was compiled "
-                   << "without support for writing into WebDAV collections";
+      CLOG(WARNING, HTTP) << "Your version of the Orthanc framework was compiled "
+                          << "without support for writing into WebDAV collections";
     }
 #endif
     
@@ -1886,7 +1886,7 @@
     }
     else
     {
-      LOG(INFO) << "Branching WebDAV bucket at: " << s;
+      CLOG(INFO, HTTP) << "Branching WebDAV bucket at: " << s;
       webDavBuckets_[s] = protection.release();
     }
   }
--- a/OrthancFramework/Sources/JobsEngine/JobsEngine.cpp	Thu Nov 05 11:43:32 2020 +0100
+++ b/OrthancFramework/Sources/JobsEngine/JobsEngine.cpp	Thu Nov 05 12:01:11 2020 +0100
@@ -122,7 +122,7 @@
   {
     assert(engine != NULL);
 
-    LOG(INFO) << "Worker thread " << workerIndex << " has started";
+    CLOG(INFO, JOBS) << "Worker thread " << workerIndex << " has started";
 
     while (engine->IsRunning())
     {
@@ -130,8 +130,8 @@
 
       if (running.IsValid())
       {
-        LOG(INFO) << "Executing job with priority " << running.GetPriority()
-                  << " in worker thread " << workerIndex << ": " << running.GetId();
+        CLOG(INFO, JOBS) << "Executing job with priority " << running.GetPriority()
+                         << " in worker thread " << workerIndex << ": " << running.GetId();
 
         while (engine->IsRunning())
         {
@@ -159,7 +159,7 @@
     if (state_ != State_Setup &&
         state_ != State_Done)
     {
-      LOG(ERROR) << "INTERNAL ERROR: JobsEngine::Stop() should be invoked manually to avoid mess in the destruction order!";
+      CLOG(ERROR, JOBS) << "INTERNAL ERROR: JobsEngine::Stop() should be invoked manually to avoid mess in the destruction order!";
       Stop();
     }
   }
@@ -269,7 +269,7 @@
 
     state_ = State_Running;
 
-    LOG(WARNING) << "The jobs engine has started with " << workers_.size() << " threads";
+    CLOG(WARNING, JOBS) << "The jobs engine has started with " << workers_.size() << " threads";
   }
 
 
@@ -286,7 +286,7 @@
       state_ = State_Stopping;
     }
 
-    LOG(INFO) << "Stopping the jobs engine";
+    CLOG(INFO, JOBS) << "Stopping the jobs engine";
       
     if (retryHandler_.joinable())
     {
@@ -310,6 +310,6 @@
       state_ = State_Done;
     }
 
-    LOG(WARNING) << "The jobs engine has stopped";
+    CLOG(WARNING, JOBS) << "The jobs engine has stopped";
   }
 }
--- a/OrthancServer/Sources/ServerJobs/LuaJobManager.cpp	Thu Nov 05 11:43:32 2020 +0100
+++ b/OrthancServer/Sources/ServerJobs/LuaJobManager.cpp	Thu Nov 05 12:01:11 2020 +0100
@@ -76,8 +76,8 @@
     }
 
     connectionManager_.SetInactivityTimeout(dicomTimeout * 1000);  // Milliseconds expected
-    LOG(INFO) << "Lua: DICOM associations will be closed after "
-              << dicomTimeout << " seconds of inactivity";
+    CLOG(INFO, LUA) << "Lua: DICOM associations will be closed after "
+                    << dicomTimeout << " seconds of inactivity";
   }
 
 
@@ -106,7 +106,7 @@
   {
     boost::mutex::scoped_lock lock(mutex_);
 
-    LOG(INFO) << "Awaking trailing sleep";
+    CLOG(INFO, LUA) << "Awaking trailing sleep";
 
     if (currentJob_ != NULL)
     {