comparison 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
comparison
equal deleted inserted replaced
3616:b6a569e6e85b 3654:427a13084241
5 #include <boost/algorithm/string.hpp> 5 #include <boost/algorithm/string.hpp>
6 #include <boost/thread.hpp> 6 #include <boost/thread.hpp>
7 7
8 namespace OrthancHelpers 8 namespace OrthancHelpers
9 { 9 {
10
11
12 inline std::string ShortenId(const std::string& orthancUuid)
13 {
14 size_t firstHyphenPos = orthancUuid.find_first_of('-');
15 if (firstHyphenPos == std::string::npos)
16 {
17 return orthancUuid;
18 }
19 else
20 {
21 return orthancUuid.substr(0, firstHyphenPos);
22 }
23 }
24
10 25
11 // Interface for loggers providing the same interface 26 // Interface for loggers providing the same interface
12 // in Orthanc framework or in an Orthanc plugins. 27 // in Orthanc framework or in an Orthanc plugins.
13 // Furthermore, compared to the LOG and VLOG macros, 28 // Furthermore, compared to the LOG and VLOG macros,
14 // these loggers will provide "contexts". 29 // these loggers will provide "contexts".