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/>.
25
QueryLoggerFile::QueryLoggerFile()
27
_fh.setf(ios::fixed, ios::floatfield);
31
QueryLoggerFile::~QueryLoggerFile()
36
bool QueryLoggerFile::logEvent(const event_t *event)
40
_fh << "# " << event->ts << "\n"
41
<< "# session_id=" << event->session_id
42
<< " query_id=" << event->query_id
43
<< " rows_examined=" << event->rows_examined
44
<< " rows_sent=" << event->rows_sent
45
<< " tmp_tables=" << event->tmp_tables
46
<< " warnings=" << event->warnings
48
<< "# execution_time=" << event->execution_time
49
<< " lock_time=" << event->lock_time
50
<< " session_time=" << event->session_time
52
<< "# error=" << event->error << "\n"
53
<< "# schema=\"" << event->schema << "\"\n"
54
<< event->query << ";\n#"
57
return false; // success
60
bool QueryLoggerFile::openLogFile(const char *file)
64
_fh.open(file, ios::app);
68
return false; // success
71
bool QueryLoggerFile::closeLogFile()
80
return false; // success