Represents the logger object to be used in the program. More...
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, params string[] arguments) | |
Constructor that takes a LoggerTypes value and optional arguments to create a new Logger class. | |
void | LogTrace (string message) |
Log trace messages to the configured output. | |
void | LogInfo (string message) |
Log informational messages to the configured output. | |
void | LogError (string message) |
Log error messages to the configured output. | |
Private Member Functions | |
void IDisposable. | Dispose () |
Dispose of this logger object in a friendly way. | |
Private Attributes | |
ILogger? | _logger |
The logger implementation represented by the ILogger interface. | |
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 15 of file Bridge_Logger.cs.
enum LoggerTypes |
A value passed to Logger.Logger() constructor to specify the type of logger to create.
Definition at line 21 of file Bridge_Logger.cs.
|
inline |
Constructor that takes a LoggerTypes value and optional arguments to create a new Logger class.
loggerType | A value from the LoggerTypes enum specifying the type of logger object to create. |
arguments | Zero or more additional arguments that some logger types require. For example, a file logger requires a filename. |
Definition at line 47 of file Bridge_Logger.cs.
References Logger._logger, ConsoleLogger.CreateConsoleLogger(), FileLogger.CreateFileLogger(), and NullLogger.CreateNullLogger().
|
inlineprivate |
Dispose of this logger object in a friendly way.
Definition at line 124 of file Bridge_Logger.cs.
References Logger._logger.
|
inline |
Log error messages to the configured output.
message | The message to log. |
Definition at line 111 of file Bridge_Logger.cs.
References Logger._logger, and ILogger.LogError().
Referenced by Bridge_Exercise._Bridge_Exercise_Demonstrate_Logging().
|
inline |
Log informational messages to the configured output.
message | The message to log. |
Definition at line 99 of file Bridge_Logger.cs.
References Logger._logger, and ILogger.LogInfo().
Referenced by Bridge_Exercise._Bridge_Exercise_Demonstrate_Logging().
|
inline |
Log trace messages to the configured output.
message | The message to log. |
Definition at line 87 of file Bridge_Logger.cs.
References Logger._logger, and ILogger.LogTrace().
Referenced by Bridge_Exercise._Bridge_Exercise_Demonstrate_Logging().
|
private |
The logger implementation represented by the ILogger interface.
Definition at line 140 of file Bridge_Logger.cs.
Referenced by Logger.__exit__(), Logger.Close(), Logger.Dispose(), Logger.LogError(), Logger.Logger(), Logger.LogInfo(), and Logger.LogTrace().