# HG changeset patch # User Sebastien Jodogne # Date 1349343476 -7200 # Node ID a6e41de88a530a1d393c0258275e6b447eb59a92 # Parent 3b45473c0a7310c8311be5d6ce50cfaafc4081fa using glog diff -r 3b45473c0a73 -r a6e41de88a53 Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Thu Oct 04 11:22:20 2012 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Thu Oct 04 11:37:56 2012 +0200 @@ -30,6 +30,7 @@ #include #include #include +#include #include "../OrthancException.h" #include "../ChunkedBuffer.h" @@ -530,7 +531,7 @@ } catch (OrthancException& e) { - std::cerr << "MongooseServer Exception [" << e.What() << "]" << std::endl; + LOG(ERROR) << "MongooseServer Exception [" << e.What() << "]"; output.SendHeader(Orthanc_HttpStatus_500_InternalServerError); } } diff -r 3b45473c0a73 -r a6e41de88a53 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Thu Oct 04 11:22:20 2012 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Thu Oct 04 11:37:56 2012 +0200 @@ -27,6 +27,7 @@ #include #include #include +#include namespace Orthanc { @@ -45,7 +46,7 @@ if (configurationFile) { Toolbox::ReadFile(content, configurationFile); - printf("Using the configuration from: [%s]\n", configurationFile); + LOG(INFO) << "Using the configuration from: " << configurationFile; } else { @@ -61,18 +62,18 @@ p /= CONFIGURATION_FILE; Toolbox::ReadFile(content, p.string()); - printf("Using the configuration from: [%s]\n", p.string().c_str()); + LOG(INFO) << "Using the configuration from: " << p.string(); } catch (OrthancException&) { // No configuration file found, give up with empty configuration - printf("Using the default Orthanc configuration\n"); + LOG(INFO) << "Using the default Orthanc configuration"; return; } #elif ORTHANC_STANDALONE == 1 // No default path for the standalone configuration - printf("Using the default Orthanc configuration\n"); + LOG(INFO) << "Using the default Orthanc configuration"; return; #else @@ -84,12 +85,12 @@ p /= "Resources"; p /= CONFIGURATION_FILE; Toolbox::ReadFile(content, p.string()); - printf("Using the configuration from: [%s]\n", p.string().c_str()); + LOG(INFO) << "Using the configuration from: " << p.string(); } catch (OrthancException&) { // No configuration file found, give up with empty configuration - printf("Using the default Orthanc configuration\n"); + LOG(INFO) << "Using the default Orthanc configuration"; return; } #endif diff -r 3b45473c0a73 -r a6e41de88a53 OrthancServer/ServerIndex.cpp --- a/OrthancServer/ServerIndex.cpp Thu Oct 04 11:22:20 2012 +0200 +++ b/OrthancServer/ServerIndex.cpp Thu Oct 04 11:37:56 2012 +0200 @@ -35,6 +35,7 @@ #include #include +#include namespace Orthanc { @@ -64,7 +65,7 @@ virtual void Compute(SQLite::FunctionContext& context) { std::string fileUuid = context.GetStringValue(0); - printf("Removing file [%s]\n", fileUuid.c_str()); + LOG(INFO) << "Removing file [" << fileUuid << "]"; if (Toolbox::IsUuid(fileUuid)) { fileStorage_.Remove(fileUuid); @@ -502,7 +503,7 @@ if (!db_.DoesTableExist("GlobalProperties")) { - printf("Creating the database\n"); + LOG(INFO) << "Creating the database"; std::string query; EmbeddedResources::GetFileResource(query, EmbeddedResources::PREPARE_DATABASE); db_.Execute(query); @@ -574,7 +575,7 @@ } catch (OrthancException& e) { - std::cout << "EXCEPT2 [" << e.What() << "]" << " " << db_.GetErrorMessage() << std::endl; + LOG(ERROR) << "EXCEPTION [" << e.What() << "]" << " " << db_.GetErrorMessage(); } return StoreStatus_Failure; @@ -603,15 +604,15 @@ switch (status) { case StoreStatus_Success: - std::cout << "New instance stored: " << GetTotalSize() << std::endl; + LOG(INFO) << "New instance stored: " << GetTotalSize() << " bytes"; break; case StoreStatus_AlreadyStored: - std::cout << "Already stored" << std::endl; + LOG(INFO) << "Already stored"; break; case StoreStatus_Failure: - std::cout << "Store failure" << std::endl; + LOG(INFO) << "Store failure"; break; } diff -r 3b45473c0a73 -r a6e41de88a53 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Thu Oct 04 11:22:20 2012 +0200 +++ b/OrthancServer/main.cpp Thu Oct 04 11:37:56 2012 +0200 @@ -152,18 +152,18 @@ httpServer.Start(); dicomServer.Start(); - printf("The server has started\n"); + LOG(INFO) << "The server has started"; Toolbox::ServerBarrier(); // Stop - printf("Finishing\n"); + LOG(INFO) << "The server is stopping"; } storeScp.Done(); } catch (OrthancException& e) { - std::cout << "EXCEPT [" << e.What() << "]" << std::endl; + LOG(ERROR) << "EXCEPTION [" << e.What() << "]"; } OrthancFinalize();