comparison 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
comparison
equal deleted inserted replaced
1484:b64f48e19ab9 1485:27661b33f624
35 35
36 #include <fstream> 36 #include <fstream>
37 #include <glog/logging.h> 37 #include <glog/logging.h>
38 #include <boost/algorithm/string/predicate.hpp> 38 #include <boost/algorithm/string/predicate.hpp>
39 39
40 #include "../Core/Logging.h"
40 #include "../Core/Uuid.h" 41 #include "../Core/Uuid.h"
41 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" 42 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h"
42 #include "../Core/HttpServer/FilesystemHttpHandler.h" 43 #include "../Core/HttpServer/FilesystemHttpHandler.h"
43 #include "../Core/Lua/LuaFunctionCall.h" 44 #include "../Core/Lua/LuaFunctionCall.h"
44 #include "../Core/DicomFormat/DicomArray.h" 45 #include "../Core/DicomFormat/DicomArray.h"
622 } 623 }
623 624
624 625
625 int main(int argc, char* argv[]) 626 int main(int argc, char* argv[])
626 { 627 {
627 // Initialize Google's logging library. 628 Logging::Initialize();
628 FLAGS_logtostderr = true;
629 FLAGS_minloglevel = 1;
630 FLAGS_v = 0;
631 629
632 for (int i = 1; i < argc; i++) 630 for (int i = 1; i < argc; i++)
633 { 631 {
634 if (std::string(argv[i]) == "--help") 632 if (std::string(argv[i]) == "--help")
635 { 633 {
643 return 0; 641 return 0;
644 } 642 }
645 643
646 if (std::string(argv[i]) == "--verbose") 644 if (std::string(argv[i]) == "--verbose")
647 { 645 {
648 FLAGS_minloglevel = 0; 646 Logging::EnableInfoLevel(true);
649 } 647 }
650 648
651 if (std::string(argv[i]) == "--trace") 649 if (std::string(argv[i]) == "--trace")
652 { 650 {
653 FLAGS_minloglevel = 0; 651 Logging::EnableTraceLevel(true);
654 FLAGS_v = 1;
655 } 652 }
656 653
657 if (boost::starts_with(argv[i], "--logdir=")) 654 if (boost::starts_with(argv[i], "--logdir="))
658 { 655 {
659 FLAGS_logtostderr = false; 656 FLAGS_logtostderr = false;
675 f << configurationSample; 672 f << configurationSample;
676 f.close(); 673 f.close();
677 return 0; 674 return 0;
678 } 675 }
679 } 676 }
680
681 google::InitGoogleLogging("Orthanc");
682 677
683 const char* configurationFile = NULL; 678 const char* configurationFile = NULL;
684 for (int i = 1; i < argc; i++) 679 for (int i = 1; i < argc; i++)
685 { 680 {
686 // Use the first argument that does not start with a "-" as 681 // Use the first argument that does not start with a "-" as
734 729
735 OrthancFinalize(); 730 OrthancFinalize();
736 731
737 LOG(WARNING) << "Orthanc has stopped"; 732 LOG(WARNING) << "Orthanc has stopped";
738 733
734 Logging::Finalize();
735
739 return status; 736 return status;
740 } 737 }