Mercurial > hg > orthanc
diff Resources/Samples/CppHelpers/Logging/ILogger.h @ 3654:427a13084241
OrthancHelpers::ShortenId to display shortened uuid in logs
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Fri, 07 Feb 2020 09:35:18 +0100 |
parents | eb48adfd931e |
children |
line wrap: on
line diff
--- 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,