Mercurial > hg > orthanc
comparison Core/Toolbox.cpp @ 1486:f967bdf8534e
refactoring to Logging.h
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Aug 2015 10:01:31 +0200 |
parents | f176ec4467e6 |
children | 596927722403 |
comparison
equal
deleted
inserted
replaced
1485:27661b33f624 | 1486:f967bdf8534e |
---|---|
32 | 32 |
33 #include "PrecompiledHeaders.h" | 33 #include "PrecompiledHeaders.h" |
34 #include "Toolbox.h" | 34 #include "Toolbox.h" |
35 | 35 |
36 #include "OrthancException.h" | 36 #include "OrthancException.h" |
37 #include "Logging.h" | |
37 | 38 |
38 #include <string> | 39 #include <string> |
39 #include <stdint.h> | 40 #include <stdint.h> |
40 #include <string.h> | 41 #include <string.h> |
41 #include <boost/filesystem.hpp> | 42 #include <boost/filesystem.hpp> |
49 #include <boost/date_time/posix_time/posix_time.hpp> | 50 #include <boost/date_time/posix_time/posix_time.hpp> |
50 #endif | 51 #endif |
51 | 52 |
52 #if BOOST_HAS_REGEX == 1 | 53 #if BOOST_HAS_REGEX == 1 |
53 #include <boost/regex.hpp> | 54 #include <boost/regex.hpp> |
54 #endif | |
55 | |
56 #if HAVE_GOOGLE_LOG == 1 | |
57 #include <glog/logging.h> | |
58 #endif | 55 #endif |
59 | 56 |
60 #if defined(_WIN32) | 57 #if defined(_WIN32) |
61 #include <windows.h> | 58 #include <windows.h> |
62 #include <process.h> // For "_spawnvp()" | 59 #include <process.h> // For "_spawnvp()" |
1133 int pid = fork(); | 1130 int pid = fork(); |
1134 | 1131 |
1135 if (pid == -1) | 1132 if (pid == -1) |
1136 { | 1133 { |
1137 // Error in fork() | 1134 // Error in fork() |
1138 #if HAVE_GOOGLE_LOG == 1 | |
1139 LOG(ERROR) << "Cannot fork a child process"; | 1135 LOG(ERROR) << "Cannot fork a child process"; |
1140 #endif | |
1141 | |
1142 throw OrthancException(ErrorCode_SystemCommand); | 1136 throw OrthancException(ErrorCode_SystemCommand); |
1143 } | 1137 } |
1144 else if (pid == 0) | 1138 else if (pid == 0) |
1145 { | 1139 { |
1146 // Execute the system command in the child process | 1140 // Execute the system command in the child process |
1156 } | 1150 } |
1157 #endif | 1151 #endif |
1158 | 1152 |
1159 if (status != 0) | 1153 if (status != 0) |
1160 { | 1154 { |
1161 #if HAVE_GOOGLE_LOG == 1 | |
1162 LOG(ERROR) << "System command failed with status code " << status; | 1155 LOG(ERROR) << "System command failed with status code " << status; |
1163 #endif | |
1164 | |
1165 throw OrthancException(ErrorCode_SystemCommand); | 1156 throw OrthancException(ErrorCode_SystemCommand); |
1166 } | 1157 } |
1167 } | 1158 } |
1168 | 1159 |
1169 | 1160 |