Implementation of the file logger, along with the CreateFileLogger() and DestroyFileLogger() factory functions used in the Bridge Pattern. More...
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "Bridge_LogHelper.h"
#include "Bridge_FileLogger.h"
Go to the source code of this file.
Functions | |
static void | _WriteLine (const char *loglevel, const char *message, FILE *fp) |
Send a formatted line to a log file. | |
static void | _File_LogTrace (const char *message, void *data) |
Write a trace message to a log file. | |
static void | _File_LogInfo (const char *message, void *data) |
Write an informational message to a log file. | |
static void | _File_LogError (const char *message, void *data) |
Write an error message to a log file. | |
ILogger * | CreateFileLogger (const char *filename) |
Create an instance of an ILogger that outputs to a file. | |
void | DestroyFileLogger (ILogger *logger) |
Destroy the given instance of an ILogger for outputting to a file. | |
Implementation of the file logger, along with the CreateFileLogger() and DestroyFileLogger() factory functions used in the Bridge Pattern.
Definition in file Bridge_FileLogger.c.
|
static |
Write an error message to a log file.
message | The message to log. |
data | The data associated with an instance of an ILogger. In this case, the file handle to write to. |
Definition at line 82 of file Bridge_FileLogger.c.
References _WriteLine().
Referenced by CreateFileLogger().
|
static |
Write an informational message to a log file.
message | The message to log. |
data | The data associated with an instance of an ILogger. In this case, the file handle to write to. |
Definition at line 65 of file Bridge_FileLogger.c.
References _WriteLine().
Referenced by CreateFileLogger().
|
static |
Write a trace message to a log file.
message | The message to log. |
data | The data associated with an instance of an ILogger. In this case, the file handle to write to. |
Definition at line 48 of file Bridge_FileLogger.c.
References _WriteLine().
Referenced by CreateFileLogger().
|
static |
Send a formatted line to a log file.
loglevel | The level of the log detail. |
message | The message to log. |
fp | Handle to file to write to. If NULL, nothing is written. |
Definition at line 21 of file Bridge_FileLogger.c.
References LogHelper_FormatLogLine().
Referenced by _File_LogError(), _File_LogInfo(), and _File_LogTrace().
ILogger * CreateFileLogger | ( | const char * | filename | ) |
Create an instance of an ILogger that outputs to a file.
filename | Name of the file to log to. The file will be overwritten. |
Definition at line 96 of file Bridge_FileLogger.c.
References _File_LogError(), _File_LogInfo(), _File_LogTrace(), ILogger::data, ILogger::LogError, ILogger::LogInfo, and ILogger::LogTrace.
Referenced by CreateLogger().
void DestroyFileLogger | ( | ILogger * | logger | ) |
Destroy the given instance of an ILogger for outputting to a file.
logger | The ILogger instance to destroy. |
Definition at line 127 of file Bridge_FileLogger.c.
References ILogger::data.
Referenced by DestroyLogger().