QueryLoggerFile implements logging to a file for the QueryLog class.
More...
#include <file.h>
Public Member Functions |
bool | logEvent (const event_t *event) |
| Format and write the event to the log file.
|
bool | openLogFile (const char *file) |
| Open new log file, close old log file if successful.
|
bool | closeLogFile () |
| Close the log file.
|
Private Attributes |
std::ofstream | _fh |
| File handle for open log file.
|
Detailed Description
QueryLoggerFile implements logging to a file for the QueryLog class.
This class is not a plugin (class QueryLog is the plugin class), it is a utility class used by the QueryLog class to do the actual logging to the query log file. QueryLog deals with Drizzle; this class deals with formatting the event and writing it to the log file.
Definition at line 34 of file file.h.
Member Function Documentation
bool QueryLoggerFile::closeLogFile |
( |
| ) |
|
Close the log file.
If query_log_file_enabled is false, then the log file is closed. However, the log file is not closed if query_log_enabled is false.
- Return values
-
true | Error, log file may not be closed |
false | Success, log file closed |
Definition at line 72 of file file.cc.
bool QueryLoggerFile::logEvent |
( |
const event_t * |
event | ) |
|
Format and write the event to the log file.
This function is called by QueryLog::afterStatement(). The given event is a uniform struct (see event.h) and has passed filtering (thresholds, etc.), so it's ready to log.
- Parameters
-
- Return values
-
true | Error, event not logged |
false | Success, event logged |
Definition at line 36 of file file.cc.
bool QueryLoggerFile::openLogFile |
( |
const char * |
file | ) |
|
Open new log file, close old log file if successful.
When global system variable query_log_file is changed, update_file() in module.cc is called which calls this function, passing it the new log file name. If opening the new log file succeeds, then the old log file is closed, else the old log if kept, and error is printed and query_log_file is not changed.
- Parameters
-
[in] | file | New log file name to open |
- Return values
-
true | Error, new log file not opened, old log file still open |
false | Success, old log file closed, new log file opened |
Definition at line 61 of file file.cc.
The documentation for this class was generated from the following files: