MySQL 5.6.14 Source Code Document
|
#include <FileLogHandler.hpp>
Public Member Functions | |
virtual const char * | handler_type () |
FileLogHandler (const char *aFileName="logger.log", int maxNoFiles=6, long maxFileSize=1024000, unsigned int maxLogEntries=10000) | |
virtual | ~FileLogHandler () |
virtual bool | open () |
virtual bool | close () |
virtual bool | is_open () |
virtual bool | setParam (const BaseString ¶m, const BaseString &value) |
virtual bool | checkParams () |
virtual bool | getParams (BaseString &config) |
virtual off_t | getCurrentSize () |
virtual off_t | getMaxSize () |
Public Member Functions inherited from LogHandler | |
LogHandler () | |
virtual | ~LogHandler () |
void | append (const char *pCategory, Logger::LoggerLevel level, const char *pMsg) |
void | append_impl (const char *pCategory, Logger::LoggerLevel level, const char *pMsg) |
const char * | getDefaultHeader (char *pStr, const char *pCategory, Logger::LoggerLevel level) const |
const char * | getDefaultFooter () const |
const char * | getDateTimeFormat () const |
void | setDateTimeFormat (const char *pFormat) |
int | getErrorCode () const |
void | setErrorCode (int code) |
char * | getErrorStr () |
void | setErrorStr (const char *str) |
bool | parseParams (const BaseString ¶ms) |
virtual void | setRepeatFrequency (unsigned val) |
Protected Member Functions | |
virtual void | writeHeader (const char *pCategory, Logger::LoggerLevel level) |
virtual void | writeMessage (const char *pMsg) |
virtual void | writeFooter () |
Protected Member Functions inherited from LogHandler | |
STATIC_CONST (MAX_DATE_TIME_HEADER_LENGTH=64) | |
STATIC_CONST (MAX_HEADER_LENGTH=128) | |
STATIC_CONST (MAX_FOOTER_LENGTH=128) |
Logs messages to a file. The log file will be archived depending on the file's size or after N number of log entries. There will be only a specified number of archived logs which will be "recycled".
The archived log file will be named as <filename>.1..N.
Definition at line 37 of file FileLogHandler.hpp.
FileLogHandler::FileLogHandler | ( | const char * | aFileName = "logger.log" , |
int | maxNoFiles = 6 , |
||
long | maxFileSize = 1024000 , |
||
unsigned int | maxLogEntries = 10000 |
||
) |
Creates a new file handler with the specified filename, max number of archived log files and max log size for each log.
aFileName | the log filename. |
maxNoFiles | the maximum number of archived log files. |
maxFileSize | the maximum log file size before archiving. |
maxLogEntries | the maximum number of log entries before checking time to archive. |
Definition at line 26 of file FileLogHandler.cpp.
|
virtual |
Destructor.
Definition at line 38 of file FileLogHandler.cpp.
|
virtual |
Checks that all necessary parameters have been set.
Reimplemented from LogHandler.
Definition at line 255 of file FileLogHandler.cpp.
|
virtual |
Closes/free any allocated resources used by the log handler.
Implements LogHandler.
Definition at line 75 of file FileLogHandler.cpp.
|
virtual |
Sets the config BaseString to the part of the LogDestination parameter needed in the config file to setup this LogHandler. i.e. passing the output of getParams to parseParams should do "nothing"
config | where to store parameters |
Reimplemented from LogHandler.
Definition at line 203 of file FileLogHandler.cpp.
|
virtual |
Check if LogHandler is open
Implements LogHandler.
Definition at line 69 of file FileLogHandler.cpp.
|
virtual |
Opens/initializes the log handler.
Implements LogHandler.
Definition at line 44 of file FileLogHandler.cpp.
|
virtual |
Sets a parameters. What parameters are accepted depends on the subclass.
param | name of parameter |
value | value of parameter |
Implements LogHandler.
Definition at line 192 of file FileLogHandler.cpp.
|
protectedvirtual |
Write the footer to the log.
The reason I also check the number of log entries instead of only the log size, is that I do not want to check the file size after each log entry which requires system calls and is quite slow. TODO: Any better way?
Implements LogHandler.
Definition at line 101 of file FileLogHandler.cpp.
|
protectedvirtual |
Write the header to the log.
pCategory | the category to tag the log with. |
level | the log level. |
Implements LogHandler.
Definition at line 88 of file FileLogHandler.cpp.
|
protectedvirtual |
Write the message to the log.
pMsg | the message to log. |
Implements LogHandler.
Definition at line 95 of file FileLogHandler.cpp.