Drizzled Public API Documentation

QueryLoggerFile Class Reference

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. More...
 
bool openLogFile (const char *file)
 Open new log file, close old log file if successful. More...
 
bool closeLogFile ()
 Close the log file. More...
 

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
trueError, log file may not be closed
falseSuccess, log file closed

Definition at line 72 of file file.cc.

Referenced by drizzle_plugin::update_file_enabled().

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
[in]eventEvent to log
Return values
trueError, event not logged
falseSuccess, 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]fileNew log file name to open
Return values
trueError, new log file not opened, old log file still open
falseSuccess, old log file closed, new log file opened

Definition at line 61 of file file.cc.

Referenced by drizzle_plugin::init(), drizzle_plugin::update_file(), and drizzle_plugin::update_file_enabled().


The documentation for this class was generated from the following files: