Design Pattern Examples
Overview of object-oriented design patterns
Bridge_ILogger.h
Go to the documentation of this file.
1
6
7#pragma once
8#ifndef __BRIDGE_ILOGGER_H__
9#define __BRIDGE_ILOGGER_H__
10
14typedef enum
15{
20
25
31
32
33typedef struct
34{
38 void (*LogTrace)(const char* message, void* data);
39
44 void (*LogInfo)(const char* message, void* data);
45
50 void (*LogError)(const char* message, void* data);
51
57
61 void* data;
62} ILogger;
63
64
74ILogger* CreateLogger(LoggerTypes loggerType, const char* filename);
75
82void DestroyLogger(ILogger* logger);
83
84#endif // __BRIDGE_ILOGGER_H__
85
LoggerTypes
A value passed to CreateLogger() to specify the type of logger to create.
@ LoggerType_ToFile
Log to a file. One additional parameter: the name of the file to log to.
@ LoggerType_ToNull
Log to nowhere, that is, throw out all logging. No additional parameters.
@ LoggerType_ToConsole
Log to the console. No additional parameters.
ILogger * CreateLogger(LoggerTypes loggerType, const char *filename)
Return an interface for the specified logger.
void DestroyLogger(ILogger *logger)
Release any resources associated with the given logger. The given ILogger instance is no longer valid...
void * data
Data associated with a specific instance of a logger.
LoggerTypes loggerType
The type of this logger, as identified by a value from the LoggerTypes enumeration.