annotate OrthancServer/Resources/Samples/CppHelpers/Logging/NullLogger.h @ 4996:0f0ada196993

more verbose error
author Alain Mazy <am@osimis.io>
date Wed, 04 May 2022 10:50:34 +0200
parents 43e613a7756b
children 0ea402b4d901
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
4829
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
7 *
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
8 * 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
9 * 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
10 * 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
11 * License, or (at your option) any later version.
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 *
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
15 * 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
16 * General Public License for more details.
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 *
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
18 * 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
19 * 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
20 **/
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21
c847b0dfd255 added missing copyright headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
22
3460
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
23 #pragma once
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
24
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
25 #include "ILogger.h"
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
26
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
27 namespace OrthancHelpers
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
28 {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
29 // a logger ... that does not log.
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
30 // Instead of writing:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
31 // if (logger != NULL)
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
32 // {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
33 // logger->Info("hello") ;
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
34 // }
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
35 // you should create a NullLogger:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
36 // logger = new NullLogger();
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
37 // ...
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
38 // logger->Info("hello");
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
39 class NullLogger : public BaseLogger {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
40 public:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
41 NullLogger() {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
42
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
43 virtual void Trace(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
44 virtual void Trace(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
45 virtual void Info(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
46 virtual void Info(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
47 virtual void Warning(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
48 virtual void Warning(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
49 virtual void Error(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
50 virtual void Error(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
51 };
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
52 }