• LogEngine
  • LogEngine Class

    (nymeaserver::LogEngine)

    The engine which creates the log databse and provides access to it. More...

    Header: #include <LogEngine>
    Inherits:

    Public Functions

    LogEngine(const QString & driver, const QString & dbName, const QString & hostname = QString( "127.0.0.1" ), const QString & username = QString(), const QString & password = QString(), int maxDBSize = 50000, QObject * parent = 0)
    ~LogEngine()
    void clearDatabase()
    QList<DeviceId> devicesInLogs() const
    void logAction(const Action & action, Logging::LoggingLevel level = Logging::LoggingLevelInfo, int errorCode = 0)
    QList<LogEntry> logEntries(const LogFilter & filter = LogFilter()) const
    void logEvent(const Event & event)
    void logRuleActionsExecuted(const Rule & rule)
    void logRuleActiveChanged(const Rule & rule)
    void logRuleEnabledChanged(const Rule & rule, const bool & enabled)
    void logRuleExitActionsExecuted(const Rule & rule)
    void logRuleTriggered(const Rule & rule)
    void logSystemEvent(const QDateTime & dateTime, bool active, Logging::LoggingLevel level = Logging::LoggingLevelInfo)
    void removeDeviceLogs(const DeviceId & deviceId)
    void removeRuleLogs(const RuleId & ruleId)
    void setMaxLogEntries(int maxLogEntries, int overflow)

    Signals

    void logDatabaseUpdated()
    void logEntryAdded(const LogEntry & logEntry)

    Detailed Description

    The engine which creates the log databse and provides access to it.

    The LogEngine creates a SQLite3 database to stores everything what's happening in the system. The database can be accessed from the API's. To control the size of the database the limit of the databse are 8000 entries.

    See also LogEntry, LogFilter, LogsResource, and LoggingHandler.

    Member Function Documentation

    LogEngine::LogEngine(const QString & driver, const QString & dbName, const QString & hostname = QString( "127.0.0.1" ), const QString & username = QString(), const QString & password = QString(), int maxDBSize = 50000, QObject * parent = 0)

    Constructs the log engine with the given parameters. The Qt Database backend to be used. Depending on the installed Qt modules this can be any of QDB2 QIBASE QMYSQL QOCI QODBC QPSQL QSQLITE QSQLITE2 QTDS. dbName is the name of the database. In case of SQLITE this should contain a file path. The Driver will create the file if required. In case of using a database server like MYSQL, the database must exist on the host given by hostname and be accessible with the given username and password.

    LogEngine::~LogEngine()

    Destructs the LogEngine.

    void LogEngine::clearDatabase()

    Removes all entries from the database. This method will be used for the tests.

    QList<DeviceId> LogEngine::devicesInLogs() const

    void LogEngine::logAction(const Action & action, Logging::LoggingLevel level = Logging::LoggingLevelInfo, int errorCode = 0)

    [signal] void LogEngine::logDatabaseUpdated()

    This signal is emitted when the log database was updated. The log database will be updated when a LogEntry was added or when a device was removed and all corresponding LogEntries were removed from the database.

    QList<LogEntry> LogEngine::logEntries(const LogFilter & filter = LogFilter()) const

    Returns the list of LogEntries of the database matching the given filter.

    See also LogEntry and LogFilter.

    [signal] void LogEngine::logEntryAdded(const LogEntry & logEntry)

    This signal is emitted when an logEntry was added to the database.

    See also LogEntry.

    void LogEngine::logEvent(const Event & event)

    void LogEngine::logRuleActionsExecuted(const Rule & rule)

    void LogEngine::logRuleActiveChanged(const Rule & rule)

    void LogEngine::logRuleEnabledChanged(const Rule & rule, const bool & enabled)

    void LogEngine::logRuleExitActionsExecuted(const Rule & rule)

    void LogEngine::logRuleTriggered(const Rule & rule)

    void LogEngine::logSystemEvent(const QDateTime & dateTime, bool active, Logging::LoggingLevel level = Logging::LoggingLevelInfo)

    void LogEngine::removeDeviceLogs(const DeviceId & deviceId)

    void LogEngine::removeRuleLogs(const RuleId & ruleId)

    void LogEngine::setMaxLogEntries(int maxLogEntries, int overflow)