Mercurial > hg > orthanc-stone
changeset 1831:a03260db8835
Added SetCallerName to IOracleCommand to ease debugging
and logging
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Thu, 03 Jun 2021 09:14:07 +0200 |
parents | fa38043b14b0 |
children | 3c0996f028a1 |
files | OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp OrthancStone/Sources/Loaders/LoaderStateMachine.cpp OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp OrthancStone/Sources/Oracle/IOracleCommand.h OrthancStone/Sources/Oracle/OracleCommandBase.h |
diffstat | 5 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp Sat May 29 11:14:20 2021 +0200 +++ b/OrthancStone/Sources/Loaders/DicomStructureSetLoader.cpp Thu Jun 03 09:14:07 2021 +0200 @@ -156,6 +156,7 @@ { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("DicomStructureSetLoader::RestInstanceLookupHandler::LookupInstance"); command->SetHttpHeader("Accept-Encoding", "gzip"); std::string uri = "/instances/" + instanceId + "/tags"; command->SetUri(uri); @@ -173,6 +174,7 @@ ++it) { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("DicomStructureSetLoader::RestInstanceLookupHandler"); command->SetUri("/tools/lookup"); command->SetMethod(Orthanc::HttpMethod_Post); command->SetBody(*it); @@ -479,6 +481,7 @@ { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("DicomStructureSetLoader::LoadInstance"); command->SetHttpHeader("Accept-Encoding", "gzip"); std::string uri = "/instances/" + instanceId + "/tags?ignore-length=3006-0050";
--- a/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp Sat May 29 11:14:20 2021 +0200 +++ b/OrthancStone/Sources/Loaders/LoaderStateMachine.cpp Thu Jun 03 09:14:07 2021 +0200 @@ -134,10 +134,11 @@ void LoaderStateMachine::HandleExceptionMessage(const OracleCommandExceptionMessage& message) { - LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing"; + LOG(ERROR) << "LoaderStateMachine::HandleExceptionMessage: error in the state machine, stopping all processing. Caller: " + << message.GetOrigin().GetCallerName(); LOG(ERROR) << "Error: " << message.GetException().What() << " Details: " << message.GetException().GetDetails(); - Clear(); + Clear(); } template <typename T> @@ -155,8 +156,8 @@ } catch (Orthanc::OrthancException& e) { - LOG(ERROR) << "Error in the state machine, stopping all processing: " << - e.What() << " Details: " << e.GetDetails(); + LOG(ERROR) << "Error in the state machine, stopping all processing. Caller: " << + message.GetOrigin().GetCallerName() << ". Error: " << e.What() << " Details: " << e.GetDetails(); Clear(); } }
--- a/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp Sat May 29 11:14:20 2021 +0200 +++ b/OrthancStone/Sources/Loaders/OrthancMultiframeVolumeLoader.cpp Thu Jun 03 09:14:07 2021 +0200 @@ -104,6 +104,7 @@ // mandatory for RT-DOSE, but is too long to be returned by default std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("OrthancMultiframeVolumeLoader::LoadGeometry"); command->SetUri("/instances/" + loader.GetInstanceId() + "/content/" + Orthanc::DICOM_TAG_GRID_FRAME_OFFSET_VECTOR.Format()); command->AcquirePayload(new LoadRTDoseGeometry(loader, dicom.release())); @@ -177,6 +178,7 @@ transferSyntaxUid_ == "1.2.840.10008.1.2.2") { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("OrthancMultiframeVolumeLoader::ScheduleFrameDownloads"); command->SetHttpHeader("Accept-Encoding", "gzip"); command->SetUri("/instances/" + instanceId_ + "/content/" + Orthanc::DICOM_TAG_PIXEL_DATA.Format() + "/0"); @@ -615,6 +617,7 @@ { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("OrthancMultiframeVolumeLoader::LoadInstance"); command->SetHttpHeader("Accept-Encoding", "gzip"); command->SetUri("/instances/" + instanceId + "/tags"); command->AcquirePayload(new LoadGeometry(*this)); @@ -623,6 +626,7 @@ { std::unique_ptr<OrthancRestApiCommand> command(new OrthancRestApiCommand); + command->SetCallerName("OrthancMultiframeVolumeLoader::LoadInstance"); command->SetUri("/instances/" + instanceId + "/metadata/TransferSyntax"); command->AcquirePayload(new LoadTransferSyntax(*this)); Schedule(command.release());
--- a/OrthancStone/Sources/Oracle/IOracleCommand.h Sat May 29 11:14:20 2021 +0200 +++ b/OrthancStone/Sources/Oracle/IOracleCommand.h Thu Jun 03 09:14:07 2021 +0200 @@ -47,6 +47,8 @@ virtual Type GetType() const = 0; + virtual std::string GetCallerName() const = 0; + // This only clones the command, *not* its possibly associated payload virtual IOracleCommand* Clone() const = 0; };
--- a/OrthancStone/Sources/Oracle/OracleCommandBase.h Sat May 29 11:14:20 2021 +0200 +++ b/OrthancStone/Sources/Oracle/OracleCommandBase.h Thu Jun 03 09:14:07 2021 +0200 @@ -35,6 +35,7 @@ { private: std::unique_ptr<Orthanc::IDynamicObject> payload_; + std::string callerName_; public: void AcquirePayload(Orthanc::IDynamicObject* payload); @@ -46,6 +47,9 @@ virtual Orthanc::IDynamicObject& GetPayload() const; + void SetCallerName(const std::string callerName) { callerName_ = callerName; } + virtual std::string GetCallerName() const { return callerName_; } + Orthanc::IDynamicObject* ReleasePayload(); }; }