Database logger - logs to the MythTV database. More...
#include <logging.h>
Public Member Functions | |
| DatabaseLogger (char *table) | |
| DatabaseLogger constructor. | |
| ~DatabaseLogger () | |
| DatabaseLogger deconstructor. | |
| bool | logmsg (LoggingItem *item) |
| Process a log message, queuing it for logging to the database. | |
| void | reopen (void) |
| Reopen the log file to facilitate log rolling. | |
| virtual void | stopDatabaseAccess (void) |
| Stop logging to the database and wait for the thread to stop. | |
Protected Member Functions | |
| bool | logqmsg (MSqlQuery &query, LoggingItem *item) |
| Actually insert a log message from the queue into the database. | |
| void | prepare (MSqlQuery &query) |
| Prepare the database query for use, and bind constant values to it. | |
Private Member Functions | |
| bool | isDatabaseReady (void) |
| Check if the database is ready for use. | |
| bool | tableExists (const QString &table) |
| Checks whether table exists and is ready for writing. | |
Private Attributes | |
| DBLoggerThread * | m_thread |
| The database queue handling thread. | |
| QString | m_query |
| The database query to insert log messages. | |
| bool | m_opened |
| The database is opened. | |
| bool | m_loggingTableExists |
| The desired logging table exists. | |
| bool | m_disabled |
| DB logging is temporarily disabled. | |
| QTime | m_disabledTime |
| Time when the DB logging was disabled. | |
| QTime | m_errorLoggingTime |
| Time when DB error logging was last done. | |
Static Private Attributes | |
| static const int | kMinDisabledTime = 1000 |
| Minimum time to disable DB logging (in ms). | |
Friends | |
| class | DBLoggerThread |
Database logger - logs to the MythTV database.
Definition at line 86 of file libmythbase/logging.h.
| DatabaseLogger::DatabaseLogger | ( | char * | table | ) |
DatabaseLogger constructor.
| table | C-string of the database table to log to |
Definition at line 412 of file logging.cpp.
| DatabaseLogger::~DatabaseLogger | ( | ) |
DatabaseLogger deconstructor.
Definition at line 435 of file logging.cpp.
| bool DatabaseLogger::logmsg | ( | LoggingItem * | item | ) | [virtual] |
Process a log message, queuing it for logging to the database.
| item | LoggingItem containing the log message to process |
Implements LoggerBase.
Definition at line 456 of file logging.cpp.
| void DatabaseLogger::reopen | ( | void | ) | [inline, virtual] |
Reopen the log file to facilitate log rolling.
Implements LoggerBase.
Definition at line 92 of file libmythbase/logging.h.
| void DatabaseLogger::stopDatabaseAccess | ( | void | ) | [virtual] |
Stop logging to the database and wait for the thread to stop.
Reimplemented from LoggerBase.
Definition at line 443 of file logging.cpp.
Referenced by ~DatabaseLogger().
| bool DatabaseLogger::logqmsg | ( | MSqlQuery & | query, | |
| LoggingItem * | item | |||
| ) | [protected] |
Actually insert a log message from the queue into the database.
| query | The database insert query to use | |
| item | LoggingItem containing the log message to insert |
Definition at line 496 of file logging.cpp.
Referenced by DBLoggerThread::run().
| void DatabaseLogger::prepare | ( | MSqlQuery & | query | ) | [protected] |
Prepare the database query for use, and bind constant values to it.
| query | The database query to prepare |
Definition at line 537 of file logging.cpp.
Referenced by DBLoggerThread::run().
| bool DatabaseLogger::isDatabaseReady | ( | void | ) | [private] |
Check if the database is ready for use.
Definition at line 547 of file logging.cpp.
Referenced by logmsg(), and DBLoggerThread::run().
| bool DatabaseLogger::tableExists | ( | const QString & | table | ) | [private] |
Checks whether table exists and is ready for writing.
| table | The name of the table to check (without schema name) |
Definition at line 567 of file logging.cpp.
Referenced by isDatabaseReady().
friend class DBLoggerThread [friend] |
Definition at line 87 of file libmythbase/logging.h.
Referenced by DatabaseLogger().
DBLoggerThread* DatabaseLogger::m_thread [private] |
The database queue handling thread.
Definition at line 101 of file libmythbase/logging.h.
Referenced by DatabaseLogger(), logmsg(), and stopDatabaseAccess().
QString DatabaseLogger::m_query [private] |
The database query to insert log messages.
Definition at line 102 of file libmythbase/logging.h.
Referenced by DatabaseLogger(), and prepare().
bool DatabaseLogger::m_opened [private] |
The database is opened.
Definition at line 103 of file libmythbase/logging.h.
Referenced by DatabaseLogger().
bool DatabaseLogger::m_loggingTableExists [private] |
The desired logging table exists.
Definition at line 104 of file libmythbase/logging.h.
Referenced by isDatabaseReady().
bool DatabaseLogger::m_disabled [private] |
DB logging is temporarily disabled.
Definition at line 105 of file libmythbase/logging.h.
Referenced by DatabaseLogger(), and logmsg().
QTime DatabaseLogger::m_disabledTime [private] |
Time when the DB logging was disabled.
Definition at line 106 of file libmythbase/logging.h.
Referenced by logmsg().
QTime DatabaseLogger::m_errorLoggingTime [private] |
Time when DB error logging was last done.
Definition at line 107 of file libmythbase/logging.h.
Referenced by logqmsg().
const int DatabaseLogger::kMinDisabledTime = 1000 [static, private] |
Minimum time to disable DB logging (in ms).
Definition at line 108 of file libmythbase/logging.h.
Referenced by logmsg().
1.6.3