Design Pattern Examples
Overview of object-oriented design patterns
Bridge_NullLogger.cpp
Go to the documentation of this file.
1
5
6#include "Bridge_NullLogger.h"
7
8namespace // Anonymous
9{
13 class NullLoggerImpl : public DesignPatternExamples_cpp::ILogger
14 {
15 public:
19 NullLoggerImpl()
20 {
21 }
22
23 // ILogger Members
24
25 void LogTrace(const std::string&)
26 {
27 }
28
29 void LogInfo(const std::string&)
30 {
31 }
32
33 void LogError(const std::string&)
34 {
35 }
36 };
37
38} // end anonymous namespace
39
40
42{
43
44 std::unique_ptr<ILogger> NullLogger::CreateLogger()
45 {
46 return std::make_unique<NullLoggerImpl>();
47 }
48
49} // end namespace
static std::unique_ptr< ILogger > CreateLogger()
Create an instance of a null logger, a logger that doesn't do anything.
Declaration of the NullLogger class used in the Bridge Pattern.
The namespace containing all Design Pattern Examples implemented in C++.
Represents an implementation of a logger object as call from the Logger class.
virtual void LogInfo(const std::string &msg)=0
Log informational messages to the configured output.
virtual void LogTrace(const std::string &msg)=0
Log trace messages to the configured output.
virtual void LogError(const std::string &msg)=0
Log error messages to the configured output.