diff OrthancServer/main.cpp @ 1485:27661b33f624

Creation of Logging.h
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 04 Aug 2015 09:35:09 +0200
parents a68545767975
children f967bdf8534e
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Sun Aug 02 15:57:45 2015 +0200
+++ b/OrthancServer/main.cpp	Tue Aug 04 09:35:09 2015 +0200
@@ -37,6 +37,7 @@
 #include <glog/logging.h>
 #include <boost/algorithm/string/predicate.hpp>
 
+#include "../Core/Logging.h"
 #include "../Core/Uuid.h"
 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h"
 #include "../Core/HttpServer/FilesystemHttpHandler.h"
@@ -624,10 +625,7 @@
 
 int main(int argc, char* argv[]) 
 {
-  // Initialize Google's logging library.
-  FLAGS_logtostderr = true;
-  FLAGS_minloglevel = 1;
-  FLAGS_v = 0;
+  Logging::Initialize();
 
   for (int i = 1; i < argc; i++)
   {
@@ -645,13 +643,12 @@
 
     if (std::string(argv[i]) == "--verbose")
     {
-      FLAGS_minloglevel = 0;
+      Logging::EnableInfoLevel(true);
     }
 
     if (std::string(argv[i]) == "--trace")
     {
-      FLAGS_minloglevel = 0;
-      FLAGS_v = 1;
+      Logging::EnableTraceLevel(true);
     }
 
     if (boost::starts_with(argv[i], "--logdir="))
@@ -678,8 +675,6 @@
     }
   }
 
-  google::InitGoogleLogging("Orthanc");
-
   const char* configurationFile = NULL;
   for (int i = 1; i < argc; i++)
   {
@@ -736,5 +731,7 @@
 
   LOG(WARNING) << "Orthanc has stopped";
 
+  Logging::Finalize();
+
   return status;
 }