Mercurial > hg > orthanc
comparison OrthancServer/DicomProtocol/DicomServer.cpp @ 102:7593b57dc1bf
switch to google log
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 03 Oct 2012 16:28:13 +0200 |
parents | 428784e59dcd |
children | 2d96cb181f45 |
comparison
equal
deleted
inserted
replaced
101:428784e59dcd | 102:7593b57dc1bf |
---|---|
20 | 20 |
21 #include "DicomServer.h" | 21 #include "DicomServer.h" |
22 | 22 |
23 #include "../../Core/OrthancException.h" | 23 #include "../../Core/OrthancException.h" |
24 #include "../../Core/Toolbox.h" | 24 #include "../../Core/Toolbox.h" |
25 #include "../Internals/DcmtkLogging.h" | |
26 #include "../Internals/CommandDispatcher.h" | 25 #include "../Internals/CommandDispatcher.h" |
27 | 26 |
28 #include <boost/thread.hpp> | 27 #include <boost/thread.hpp> |
29 #include <dcmtk/dcmdata/dcdict.h> | 28 #include <dcmtk/dcmdata/dcdict.h> |
29 #include <glog/logging.h> | |
30 | 30 |
31 | 31 |
32 namespace Orthanc | 32 namespace Orthanc |
33 { | 33 { |
34 struct DicomServer::PImpl | 34 struct DicomServer::PImpl |
45 dcmDisableGethostbyaddr.set(OFTrue); | 45 dcmDisableGethostbyaddr.set(OFTrue); |
46 | 46 |
47 /* make sure data dictionary is loaded */ | 47 /* make sure data dictionary is loaded */ |
48 if (!dcmDataDict.isDictionaryLoaded()) | 48 if (!dcmDataDict.isDictionaryLoaded()) |
49 { | 49 { |
50 LOG4CPP_WARN(Internals::GetLogger(), "no data dictionary loaded, check environment variable: " | 50 LOG(WARNING) << "no data dictionary loaded, check environment variable: " << DCM_DICT_ENVIRONMENT_VARIABLE; |
51 DCM_DICT_ENVIRONMENT_VARIABLE); | |
52 } | 51 } |
53 | 52 |
54 /* initialize network, i.e. create an instance of T_ASC_Network*. */ | 53 /* initialize network, i.e. create an instance of T_ASC_Network*. */ |
55 T_ASC_Network *net; | 54 T_ASC_Network *net; |
56 OFCondition cond = ASC_initializeNetwork | 55 OFCondition cond = ASC_initializeNetwork |
57 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net); | 56 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net); |
58 if (cond.bad()) | 57 if (cond.bad()) |
59 { | 58 { |
60 LOG4CPP_ERROR(Internals::GetLogger(), "cannot create network: " + std::string(cond.text())); | 59 LOG(ERROR) << "cannot create network: " << cond.text(); |
61 throw OrthancException("Cannot create network"); | 60 throw OrthancException("Cannot create network"); |
62 } | 61 } |
63 | 62 |
64 LOG4CPP_WARN(Internals::GetLogger(), "DICOM server started"); | 63 LOG(WARNING) << "DICOM server started"; |
65 | 64 |
66 server->started_ = true; | 65 server->started_ = true; |
67 | 66 |
68 while (server->continue_) | 67 while (server->continue_) |
69 { | 68 { |
82 IRunnableBySteps::RunUntilDone(*dispatcher); | 81 IRunnableBySteps::RunUntilDone(*dispatcher); |
83 } | 82 } |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 LOG4CPP_WARN(Internals::GetLogger(), "DICOM server stopping"); | 86 LOG(WARNING) << "DICOM server stopping"; |
88 | 87 |
89 /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ | 88 /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */ |
90 /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ | 89 /* is the counterpart of ASC_initializeNetwork(...) which was called above. */ |
91 cond = ASC_dropNetwork(&net); | 90 cond = ASC_dropNetwork(&net); |
92 if (cond.bad()) | 91 if (cond.bad()) |
93 { | 92 { |
94 LOG4CPP_ERROR(Internals::GetLogger(), "Error while dropping the network: " + std::string(cond.text())); | 93 LOG(ERROR) << "Error while dropping the network: " << cond.text(); |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
98 | 97 |
99 DicomServer::DicomServer() : pimpl_(new PImpl) | 98 DicomServer::DicomServer() : pimpl_(new PImpl) |