# HG changeset patch # User Alain Mazy # Date 1754928669 -7200 # Node ID ca3d1f3a94121e617fc28563c13c71c05ce999cc # Parent 4c0dc2ad1d7586dfe4fca104b974cead2208b481 log-data-format option to get the log data in b64 (default) or json (cont) diff -r 4c0dc2ad1d75 -r ca3d1f3a9412 Framework/Plugins/DatabaseBackendAdapterV4.cpp --- a/Framework/Plugins/DatabaseBackendAdapterV4.cpp Mon Aug 11 18:03:11 2025 +0200 +++ b/Framework/Plugins/DatabaseBackendAdapterV4.cpp Mon Aug 11 18:11:09 2025 +0200 @@ -1673,19 +1673,25 @@ serializedAuditLog["ResourceType"] = level; - // TODO - Shouldn't the "LogData" information be Base64-encoded? - // Plugins are not required to write JSON (e.g., could be Protocol Buffers) if (logDataInJson) { if (it->GetLogData().empty()) { - serializedAuditLog["LogData"] = Json::nullValue; + serializedAuditLog["JsonLogData"] = Json::nullValue; } else { Json::Value logData; - Orthanc::Toolbox::ReadJson(logData, it->GetLogData()); - serializedAuditLog["LogData"] = logData; + if (Orthanc::Toolbox::ReadJson(logData, it->GetLogData())) + { + serializedAuditLog["JsonLogData"] = logData; + } + else // if the data is not json compatible, export it in b64 anyway + { + std::string b64logData; + Orthanc::Toolbox::EncodeBase64(b64logData, it->GetLogData()); + serializedAuditLog["Base64LogData"] = b64logData; + } } } else @@ -1695,7 +1701,7 @@ { Orthanc::Toolbox::EncodeBase64(b64logData, it->GetLogData()); } - serializedAuditLog["LogData"] = b64logData; + serializedAuditLog["Base64LogData"] = b64logData; } jsonLogs.append(serializedAuditLog);