1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright 2011 Daniel Nichter
6
* This program is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
* QueryLoggerFile implements logging to a file for the QueryLog class.
29
* This class is not a plugin (class QueryLog is the plugin class), it is
30
* a utility class used by the QueryLog class to do the actual logging to
31
* the query log file. QueryLog deals with Drizzle; this class deals with
32
* formatting the event and writing it to the log file.
42
* Format and write the event to the log file.
45
* This function is called by QueryLog::afterStatement(). The given
46
* event is a uniform struct (see event.h) and has passed filtering
47
* (thresholds, etc.), so it's ready to log.
49
* @param[in] event Event to log
51
* @retval true Error, event not logged
52
* @retval false Success, event logged
54
bool logEvent(const event_t *event);
58
* Open new log file, close old log file if successful.
61
* When global system variable query_log_file is changed, update_file()
62
* in module.cc is called which calls this function, passing it the new
63
* log file name. If opening the new log file succeeds, then the old log
64
* file is closed, else the old log if kept, and error is printed and
65
* query_log_file is not changed.
67
* @param[in] file New log file name to open
69
* @retval true Error, new log file not opened, old log file still open
70
* @retval false Success, old log file closed, new log file opened
72
bool openLogFile(const char *file);
79
* If query_log_file_enabled is false, then the log file is closed.
80
* However, the log file is not closed if query_log_enabled is false.
82
* @retval true Error, log file may not be closed
83
* @retval false Success, log file closed
88
std::ofstream _fh; ///< File handle for open log file