comparison Framework/Orthanc/Core/Logging.cpp @ 15:da2cf3ace87a

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 17:20:44 +0100
parents 9220cf4a63d5
children
comparison
equal deleted inserted replaced
14:0b9034112fde 15:da2cf3ace87a
81 *********************************************************/ 81 *********************************************************/
82 82
83 #include "OrthancException.h" 83 #include "OrthancException.h"
84 #include "Enumerations.h" 84 #include "Enumerations.h"
85 #include "Toolbox.h" 85 #include "Toolbox.h"
86 #include "SystemToolbox.h"
86 87
87 #include <fstream> 88 #include <fstream>
88 #include <boost/filesystem.hpp> 89 #include <boost/filesystem.hpp>
89 #include <boost/thread.hpp> 90 #include <boost/thread.hpp>
90 91
148 In this implementation : "hostname" and "username" are not used 149 In this implementation : "hostname" and "username" are not used
149 **/ 150 **/
150 151
151 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); 152 boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
152 boost::filesystem::path root(directory); 153 boost::filesystem::path root(directory);
153 boost::filesystem::path exe(Toolbox::GetPathToExecutable()); 154 boost::filesystem::path exe(SystemToolbox::GetPathToExecutable());
154 155
155 if (!boost::filesystem::exists(root) || 156 if (!boost::filesystem::exists(root) ||
156 !boost::filesystem::is_directory(root)) 157 !boost::filesystem::is_directory(root))
157 { 158 {
158 throw OrthancException(ErrorCode_CannotWriteFile); 159 throw OrthancException(ErrorCode_CannotWriteFile);
164 now.date().month().as_number(), 165 now.date().month().as_number(),
165 now.date().day().as_number(), 166 now.date().day().as_number(),
166 now.time_of_day().hours(), 167 now.time_of_day().hours(),
167 now.time_of_day().minutes(), 168 now.time_of_day().minutes(),
168 now.time_of_day().seconds(), 169 now.time_of_day().seconds(),
169 Toolbox::GetProcessId()); 170 SystemToolbox::GetProcessId());
170 171
171 std::string programName = exe.filename().replace_extension("").string(); 172 std::string programName = exe.filename().replace_extension("").string();
172 173
173 log = (root / (programName + ".log" + suffix + "." + std::string(date))); 174 log = (root / (programName + ".log" + suffix + "." + std::string(date)));
174 link = (root / (programName + ".log" + suffix)); 175 link = (root / (programName + ".log" + suffix));