Mercurial > hg > orthanc
comparison OrthancServer/Resources/Samples/CppHelpers/Logging/OrthancPluginLogger.cpp @ 4044:d25f4c0fa160 framework
splitting code into OrthancFramework and OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 10 Jun 2020 20:30:34 +0200 |
parents | Resources/Samples/CppHelpers/Logging/OrthancPluginLogger.cpp@fbe22748cd9c |
children | c847b0dfd255 |
comparison
equal
deleted
inserted
replaced
4043:6c6239aec462 | 4044:d25f4c0fa160 |
---|---|
1 #include "OrthancPluginLogger.h" | |
2 | |
3 namespace OrthancHelpers | |
4 { | |
5 | |
6 OrthancPluginLogger::OrthancPluginLogger(OrthancPluginContext *context) | |
7 : pluginContext_(context), | |
8 hasAlreadyLoggedTraceWarning_(false) | |
9 { | |
10 } | |
11 | |
12 void OrthancPluginLogger::Trace(const char *message) | |
13 { | |
14 Trace(std::string(message)); | |
15 } | |
16 | |
17 void OrthancPluginLogger::Trace(const std::string &message) | |
18 { | |
19 if (!hasAlreadyLoggedTraceWarning_) | |
20 { | |
21 Warning("Trying to log 'TRACE' level information in a plugin is not possible. These logs won't appear."); | |
22 hasAlreadyLoggedTraceWarning_ = true; | |
23 } | |
24 } | |
25 | |
26 void OrthancPluginLogger::Info(const char *message) | |
27 { | |
28 Info(std::string(message)); | |
29 } | |
30 | |
31 void OrthancPluginLogger::Info(const std::string &message) | |
32 { | |
33 OrthancPluginLogInfo(pluginContext_, (GetContext() + " " + message).c_str()); | |
34 } | |
35 | |
36 void OrthancPluginLogger::Warning(const char *message) | |
37 { | |
38 Warning(std::string(message)); | |
39 } | |
40 | |
41 void OrthancPluginLogger::Warning(const std::string &message) | |
42 { | |
43 OrthancPluginLogWarning(pluginContext_, (GetContext() + " " + message).c_str()); | |
44 } | |
45 | |
46 void OrthancPluginLogger::Error(const char *message) | |
47 { | |
48 Error(std::string(message)); | |
49 } | |
50 | |
51 void OrthancPluginLogger::Error(const std::string &message) | |
52 { | |
53 OrthancPluginLogError(pluginContext_, (GetContext() + " " + message).c_str()); | |
54 } | |
55 } // namespace OrthancHelpers |