Mercurial > hg > orthanc
diff Core/OrthancException.h @ 2960:74a5a7fd6e0e
log flag to OrthancPluginSetHttpErrorDetails
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 04 Dec 2018 18:56:39 +0100 |
parents | d924f9bb61cc |
children | 9cc3d40e389b |
line wrap: on
line diff
--- a/Core/OrthancException.h Tue Dec 04 16:43:53 2018 +0100 +++ b/Core/OrthancException.h Tue Dec 04 18:56:39 2018 +0100 @@ -73,13 +73,17 @@ } OrthancException(ErrorCode errorCode, - const std::string& details) : + const std::string& details, + bool log = true) : errorCode_(errorCode), httpStatus_(ConvertErrorCodeToHttpStatus(errorCode)), details_(new std::string(details)) { #if ORTHANC_ENABLE_LOGGING == 1 - LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; + if (log) + { + LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; + } #endif } @@ -92,13 +96,17 @@ OrthancException(ErrorCode errorCode, HttpStatus httpStatus, - const std::string& details) : + const std::string& details, + bool log = true) : errorCode_(errorCode), httpStatus_(httpStatus), details_(new std::string(details)) { #if ORTHANC_ENABLE_LOGGING == 1 - LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; + if (log) + { + LOG(ERROR) << EnumerationToString(errorCode_) << ": " << details; + } #endif }