# HG changeset patch # User Alain Mazy # Date 1581064518 -3600 # Node ID 427a130842413d5215742787b87c3b265d3f406d # Parent b6a569e6e85bbee2e40fca719cf8c5f2ed76024f OrthancHelpers::ShortenId to display shortened uuid in logs diff -r b6a569e6e85b -r 427a13084241 Resources/Samples/CppHelpers/Logging/ILogger.h --- a/Resources/Samples/CppHelpers/Logging/ILogger.h Thu Jan 23 12:58:08 2020 +0100 +++ b/Resources/Samples/CppHelpers/Logging/ILogger.h Fri Feb 07 09:35:18 2020 +0100 @@ -8,6 +8,21 @@ namespace OrthancHelpers { + + inline std::string ShortenId(const std::string& orthancUuid) + { + size_t firstHyphenPos = orthancUuid.find_first_of('-'); + if (firstHyphenPos == std::string::npos) + { + return orthancUuid; + } + else + { + return orthancUuid.substr(0, firstHyphenPos); + } + } + + // Interface for loggers providing the same interface // in Orthanc framework or in an Orthanc plugins. // Furthermore, compared to the LOG and VLOG macros,