Represents the logger object to be used in the program. More...
#include <Bridge_Logger.h>
Public Types | |
enum | LoggerTypes { ToNull , ToFile , ToConsole } |
A value passed to Logger.Logger() constructor to specify the type of logger to create. More... | |
Public Member Functions | |
Logger (LoggerTypes loggerType) | |
Constructor that takes a LoggerTypes value to create a new Logger class. | |
Logger (const std::string &filename) | |
Constructor that creates a file logger. | |
void | LogTrace (std::string message) |
void | LogInfo (std::string message) |
Log informational messages to the configured output. | |
void | LogError (std::string message) |
Log error messages to the configured output. | |
Private Attributes | |
std::unique_ptr< ILogger > | _logger |
Represents the logger object to be used in the program.
This class wraps different implementations of loggers to show the Bridge Pattern.
Definition at line 22 of file Bridge_Logger.h.
enum LoggerTypes |
A value passed to Logger.Logger() constructor to specify the type of logger to create.
Definition at line 33 of file Bridge_Logger.h.
Logger | ( | LoggerTypes | loggerType | ) |
Constructor that takes a LoggerTypes value to create a new Logger class.
loggerType | A value from the LoggerTypes enum specifying the type of logger object to create. |
<exception name="exception>Logger.ToFile type was specified but no filename was given. Use Logger(const std::string&) instead.
Definition at line 24 of file Bridge_Logger.cpp.
References Logger::_logger, ConsoleLogger::CreateLogger(), NullLogger::CreateLogger(), Logger::ToConsole, Logger::ToFile, and Logger::ToNull.
Logger | ( | const std::string & | filename | ) |
Constructor that creates a file logger.
filename | Path to a file to create for the file logger. |
Definition at line 53 of file Bridge_Logger.cpp.
References Logger::_logger, and FileLogger::CreateLogger().
void LogError | ( | std::string | message | ) |
Log error messages to the configured output.
message | The message to log. |
Definition at line 84 of file Bridge_Logger.cpp.
References Logger::_logger.
void LogInfo | ( | std::string | message | ) |
Log informational messages to the configured output.
message | The message to log. |
Definition at line 73 of file Bridge_Logger.cpp.
References Logger::_logger.
void LogTrace | ( | std::string | message | ) |
Log trace messages to the configured output.
message | The message to log. |
Definition at line 62 of file Bridge_Logger.cpp.
References Logger::_logger.
|
private |
Definition at line 26 of file Bridge_Logger.h.
Referenced by Logger::__exit__(), Logger::Close(), Logger::LogError(), Logger::Logger(), Logger::LogInfo(), and Logger::LogTrace().