Mercurial > hg > orthanc
comparison OrthancServer/OrthancInitialization.cpp @ 108:a6e41de88a53
using glog
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 04 Oct 2012 11:37:56 +0200 |
parents | c35eee0cbd12 |
children | fe180eae201d |
comparison
equal
deleted
inserted
replaced
107:3b45473c0a73 | 108:a6e41de88a53 |
---|---|
25 | 25 |
26 #include <boost/lexical_cast.hpp> | 26 #include <boost/lexical_cast.hpp> |
27 #include <boost/filesystem.hpp> | 27 #include <boost/filesystem.hpp> |
28 #include <curl/curl.h> | 28 #include <curl/curl.h> |
29 #include <boost/thread.hpp> | 29 #include <boost/thread.hpp> |
30 #include <glog/logging.h> | |
30 | 31 |
31 namespace Orthanc | 32 namespace Orthanc |
32 { | 33 { |
33 static const char* CONFIGURATION_FILE = "Configuration.json"; | 34 static const char* CONFIGURATION_FILE = "Configuration.json"; |
34 | 35 |
43 std::string content; | 44 std::string content; |
44 | 45 |
45 if (configurationFile) | 46 if (configurationFile) |
46 { | 47 { |
47 Toolbox::ReadFile(content, configurationFile); | 48 Toolbox::ReadFile(content, configurationFile); |
48 printf("Using the configuration from: [%s]\n", configurationFile); | 49 LOG(INFO) << "Using the configuration from: " << configurationFile; |
49 } | 50 } |
50 else | 51 else |
51 { | 52 { |
52 #if 0 && ORTHANC_STANDALONE == 1 && defined(__linux) | 53 #if 0 && ORTHANC_STANDALONE == 1 && defined(__linux) |
53 // Unused anymore | 54 // Unused anymore |
59 p /= "etc"; | 60 p /= "etc"; |
60 p /= "orthanc"; | 61 p /= "orthanc"; |
61 p /= CONFIGURATION_FILE; | 62 p /= CONFIGURATION_FILE; |
62 | 63 |
63 Toolbox::ReadFile(content, p.string()); | 64 Toolbox::ReadFile(content, p.string()); |
64 printf("Using the configuration from: [%s]\n", p.string().c_str()); | 65 LOG(INFO) << "Using the configuration from: " << p.string(); |
65 } | 66 } |
66 catch (OrthancException&) | 67 catch (OrthancException&) |
67 { | 68 { |
68 // No configuration file found, give up with empty configuration | 69 // No configuration file found, give up with empty configuration |
69 printf("Using the default Orthanc configuration\n"); | 70 LOG(INFO) << "Using the default Orthanc configuration"; |
70 return; | 71 return; |
71 } | 72 } |
72 | 73 |
73 #elif ORTHANC_STANDALONE == 1 | 74 #elif ORTHANC_STANDALONE == 1 |
74 // No default path for the standalone configuration | 75 // No default path for the standalone configuration |
75 printf("Using the default Orthanc configuration\n"); | 76 LOG(INFO) << "Using the default Orthanc configuration"; |
76 return; | 77 return; |
77 | 78 |
78 #else | 79 #else |
79 // In a non-standalone build, we use the | 80 // In a non-standalone build, we use the |
80 // "Resources/Configuration.json" from the Orthanc distribution | 81 // "Resources/Configuration.json" from the Orthanc distribution |
82 { | 83 { |
83 boost::filesystem::path p = ORTHANC_PATH; | 84 boost::filesystem::path p = ORTHANC_PATH; |
84 p /= "Resources"; | 85 p /= "Resources"; |
85 p /= CONFIGURATION_FILE; | 86 p /= CONFIGURATION_FILE; |
86 Toolbox::ReadFile(content, p.string()); | 87 Toolbox::ReadFile(content, p.string()); |
87 printf("Using the configuration from: [%s]\n", p.string().c_str()); | 88 LOG(INFO) << "Using the configuration from: " << p.string(); |
88 } | 89 } |
89 catch (OrthancException&) | 90 catch (OrthancException&) |
90 { | 91 { |
91 // No configuration file found, give up with empty configuration | 92 // No configuration file found, give up with empty configuration |
92 printf("Using the default Orthanc configuration\n"); | 93 LOG(INFO) << "Using the default Orthanc configuration"; |
93 return; | 94 return; |
94 } | 95 } |
95 #endif | 96 #endif |
96 } | 97 } |
97 | 98 |