Design Pattern Examples
Overview of object-oriented design patterns
ConsoleLogger Class Reference

Represents a logger that writes to the console window. More...

Inheritance diagram for ConsoleLogger:
Inheritance graph
Collaboration diagram for ConsoleLogger:
Collaboration graph

Static Public Member Functions

static ILogger CreateConsoleLogger ()
 Create an instance of a console logger, where logging goes to the console.
 

Private Member Functions

 ConsoleLogger ()
 Constructor.
 
void _WriteLine (string logLevel, string msg)
 Send a formatted line to the console.
 
void ILogger. LogTrace (string msg)
 Log trace messages to the configured output.
 
void ILogger. LogInfo (string msg)
 Log informational messages to the configured output.
 
void ILogger. LogError (string msg)
 Log error messages to the configured output.
 
void IDisposable. Dispose ()
 Shut down the logger gracefully (in this case, nothing really needs to be done).
 

Private Attributes

bool _disposed
 

Additional Inherited Members

void LogTrace (string msg)
 Log trace messages to the configured output.
 
void LogInfo (string msg)
 Log informational messages to the configured output.
 
void LogError (string msg)
 Log error messages to the configured output.
 

Detailed Description

Represents a logger that writes to the console window.

Definition at line 13 of file Bridge_ConsoleLogger.cs.

Constructor & Destructor Documentation

◆ ConsoleLogger()

ConsoleLogger ( )
inlineprivate

Constructor.

Definition at line 20 of file Bridge_ConsoleLogger.cs.

Referenced by ConsoleLogger.CreateConsoleLogger().

Member Function Documentation

◆ _WriteLine()

void _WriteLine ( string  logLevel,
string  msg 
)
inlineprivate

Send a formatted line to the console.

Parameters
logLevelThe level of the log detail.
msgThe message to log.

Definition at line 30 of file Bridge_ConsoleLogger.cs.

References LoggerHelpers.FormatLogLine().

Referenced by FileLogger.LogError(), ConsoleLogger.LogError(), FileLogger.LogInfo(), ConsoleLogger.LogInfo(), FileLogger.LogTrace(), and ConsoleLogger.LogTrace().

◆ CreateConsoleLogger()

static ILogger CreateConsoleLogger ( )
inlinestatic

Create an instance of a console logger, where logging goes to the console.

Returns
An instance of an ILogger object.

Definition at line 77 of file Bridge_ConsoleLogger.cs.

References ConsoleLogger.ConsoleLogger().

Referenced by Logger.Logger().

◆ Dispose()

void IDisposable. Dispose ( )
inlineprivate

Shut down the logger gracefully (in this case, nothing really needs to be done).

Definition at line 62 of file Bridge_ConsoleLogger.cs.

References ConsoleLogger._disposed.

◆ LogError()

void ILogger. LogError ( string  msg)
inlineprivate

Log error messages to the configured output.

Parameters
msgThe message to log.

Implements ILogger.

Definition at line 50 of file Bridge_ConsoleLogger.cs.

References ConsoleLogger._WriteLine().

◆ LogInfo()

void ILogger. LogInfo ( string  msg)
inlineprivate

Log informational messages to the configured output.

Parameters
msgThe message to log.

Implements ILogger.

Definition at line 45 of file Bridge_ConsoleLogger.cs.

References ConsoleLogger._WriteLine().

◆ LogTrace()

void ILogger. LogTrace ( string  msg)
inlineprivate

Log trace messages to the configured output.

Parameters
msgThe message to log.

Implements ILogger.

Definition at line 40 of file Bridge_ConsoleLogger.cs.

References ConsoleLogger._WriteLine().

Member Data Documentation

◆ _disposed

bool _disposed
private

Definition at line 15 of file Bridge_ConsoleLogger.cs.

Referenced by ConsoleLogger.Dispose().


The documentation for this class was generated from the following file: