annotate Resources/Samples/CppHelpers/Logging/NullLogger.h @ 3794:08ee586e2b01

fix address
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 26 Mar 2020 15:53:54 +0100
parents fbe22748cd9c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3460
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
1 #pragma once
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
2
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
3 #include "ILogger.h"
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
4
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
5 namespace OrthancHelpers
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
6 {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
7 // a logger ... that does not log.
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
8 // Instead of writing:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
9 // if (logger != NULL)
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
10 // {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
11 // logger->Info("hello") ;
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
12 // }
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
13 // you should create a NullLogger:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
14 // logger = new NullLogger();
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
15 // ...
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
16 // logger->Info("hello");
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
17 class NullLogger : public BaseLogger {
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
18 public:
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
19 NullLogger() {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
20
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
21 virtual void Trace(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
22 virtual void Trace(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
23 virtual void Info(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
24 virtual void Info(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
25 virtual void Warning(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
26 virtual void Warning(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
27 virtual void Error(const char* message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
28 virtual void Error(const std::string& message) {}
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
29 };
fbe22748cd9c added logging OrthancHelpers
Alain Mazy <alain@mazy.be>
parents:
diff changeset
30 }