Mercurial > hg > orthanc
annotate OrthancServer/Resources/Samples/CppHelpers/Logging/OrthancPluginLogger.cpp @ 4829:c847b0dfd255
added missing copyright headers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 18:53:08 +0100 |
parents | d25f4c0fa160 |
children | 7053502fbf97 |
rev | line source |
---|---|
4829
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
1 /** |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
6 * |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU General Public License as |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * published by the Free Software Foundation, either version 3 of the |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * License, or (at your option) any later version. |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * General Public License for more details. |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 * |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU General Public License |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 **/ |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 |
c847b0dfd255
added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 |
3460 | 22 #include "OrthancPluginLogger.h" |
23 | |
24 namespace OrthancHelpers | |
25 { | |
26 | |
27 OrthancPluginLogger::OrthancPluginLogger(OrthancPluginContext *context) | |
28 : pluginContext_(context), | |
29 hasAlreadyLoggedTraceWarning_(false) | |
30 { | |
31 } | |
32 | |
33 void OrthancPluginLogger::Trace(const char *message) | |
34 { | |
35 Trace(std::string(message)); | |
36 } | |
37 | |
38 void OrthancPluginLogger::Trace(const std::string &message) | |
39 { | |
40 if (!hasAlreadyLoggedTraceWarning_) | |
41 { | |
42 Warning("Trying to log 'TRACE' level information in a plugin is not possible. These logs won't appear."); | |
43 hasAlreadyLoggedTraceWarning_ = true; | |
44 } | |
45 } | |
46 | |
47 void OrthancPluginLogger::Info(const char *message) | |
48 { | |
49 Info(std::string(message)); | |
50 } | |
51 | |
52 void OrthancPluginLogger::Info(const std::string &message) | |
53 { | |
54 OrthancPluginLogInfo(pluginContext_, (GetContext() + " " + message).c_str()); | |
55 } | |
56 | |
57 void OrthancPluginLogger::Warning(const char *message) | |
58 { | |
59 Warning(std::string(message)); | |
60 } | |
61 | |
62 void OrthancPluginLogger::Warning(const std::string &message) | |
63 { | |
64 OrthancPluginLogWarning(pluginContext_, (GetContext() + " " + message).c_str()); | |
65 } | |
66 | |
67 void OrthancPluginLogger::Error(const char *message) | |
68 { | |
69 Error(std::string(message)); | |
70 } | |
71 | |
72 void OrthancPluginLogger::Error(const std::string &message) | |
73 { | |
74 OrthancPluginLogError(pluginContext_, (GetContext() + " " + message).c_str()); | |
75 } | |
76 } // namespace OrthancHelpers |