Design Pattern Examples
Overview of object-oriented design patterns
Bridge_NullLogger.c File Reference

Implementation of the null logger, along with the CreateNullLogger() and DestroyNullLogger() factory functions used in the Bridge Pattern. More...

#include <stdlib.h>
#include "Bridge_NullLogger.h"
Include dependency graph for Bridge_NullLogger.c:

Go to the source code of this file.

Functions

static void _Null_LogTrace (const char *message, void *data)
 Write a trace message to a null logger (basically, discard the log message).
 
static void _Null_LogInfo (const char *message, void *data)
 Write an informational message to a null logger (basically, discard the log message).
 
static void _Null_LogError (const char *message, void *data)
 Write an error message to a null logger (basically, discard the log message).
 
ILoggerCreateNullLogger (void)
 Create an instance of an ILogger that outputs to a console.
 
void DestroyNullLogger (ILogger *logger)
 Destroy the given instance of an ILogger for outputting to a console.
 

Detailed Description

Implementation of the null logger, along with the CreateNullLogger() and DestroyNullLogger() factory functions used in the Bridge Pattern.

Definition in file Bridge_NullLogger.c.

Function Documentation

◆ _Null_LogError()

static void _Null_LogError ( const char *  message,
void *  data 
)
static

Write an error message to a null logger (basically, discard the log message).

Parameters
messageUnused.
dataUnused.

Definition at line 47 of file Bridge_NullLogger.c.

Referenced by CreateNullLogger().

◆ _Null_LogInfo()

static void _Null_LogInfo ( const char *  message,
void *  data 
)
static

Write an informational message to a null logger (basically, discard the log message).

Parameters
messageUnused.
dataUnused.

Definition at line 32 of file Bridge_NullLogger.c.

Referenced by CreateNullLogger().

◆ _Null_LogTrace()

static void _Null_LogTrace ( const char *  message,
void *  data 
)
static

Write a trace message to a null logger (basically, discard the log message).

Parameters
messageUnused.
dataUnused.

Definition at line 17 of file Bridge_NullLogger.c.

Referenced by CreateNullLogger().

◆ CreateNullLogger()

ILogger * CreateNullLogger ( void  )

Create an instance of an ILogger that outputs to a console.

Returns
Returns an ILogger instance to use for logging to a console; returns NULL if something went wrong in creating the logger.

Definition at line 60 of file Bridge_NullLogger.c.

References _Null_LogError(), _Null_LogInfo(), _Null_LogTrace(), ILogger::data, ILogger::LogError, ILogger::LogInfo, and ILogger::LogTrace.

Referenced by CreateLogger().

◆ DestroyNullLogger()

void DestroyNullLogger ( ILogger logger)

Destroy the given instance of an ILogger for outputting to a console.

Parameters
loggerThe ILogger instance to destroy.

Definition at line 77 of file Bridge_NullLogger.c.

Referenced by DestroyLogger().