Beispiel #1
0
void FileLogger::vLog(LogLevelFlag lvl, const char *file, int line, std::string &message) {
    if (lvl >= mLogLevel) {
        if (currentAmount < maxBulkEntry - 1) {
            appendLogEntry(lvl, file, line, message);
        } else {
            writePendingLogsIntoFileAndSwap();
            appendLogEntry(lvl, file, line, message);
        }
    }
}
Beispiel #2
0
void LogEngine::logRuleActiveChanged(const Rule &rule)
{
    LogEntry entry(Logging::LoggingSourceRules);
    entry.setTypeId(rule.id());
    entry.setActive(rule.active());
    appendLogEntry(entry);
}
Beispiel #3
0
void LogEngine::logSystemEvent(bool active, Logging::LoggingLevel level)
{
    LogEntry entry(level, Logging::LoggingSourceSystem);
    entry.setActive(active);
    appendLogEntry(entry);
    emit logEntryAdded(entry);
}
Beispiel #4
0
void LogEngine::logRuleTriggered(const Rule &rule)
{
    LogEntry entry(Logging::LoggingSourceRules);
    entry.setTypeId(rule.id());
    appendLogEntry(entry);
    emit logEntryAdded(entry);
}
Beispiel #5
0
void LogEngine::logAction(const Action &action, Logging::LoggingLevel level, int errorCode)
{
    QStringList valueList;
    foreach (const Param &param, action.params()) {
        valueList << param.value().toString();
    }
    LogEntry entry(level, Logging::LoggingSourceActions, errorCode);
    entry.setTypeId(action.actionTypeId());
    entry.setDeviceId(action.deviceId());
    entry.setValue(valueList.join(", "));
    appendLogEntry(entry);
}
Beispiel #6
0
void LogEngine::logEvent(const Event &event)
{
    QStringList valueList;
    Logging::LoggingSource sourceType;
    if (event.isStateChangeEvent()) {
        sourceType = Logging::LoggingSourceStates;
        valueList << event.param("value").value().toString();
    } else {
        sourceType = Logging::LoggingSourceEvents;
        foreach (const Param &param, event.params()) {
            valueList << param.value().toString();
        }
    }
    LogEntry entry(sourceType);
    entry.setTypeId(event.eventTypeId());
    entry.setDeviceId(event.deviceId());
    entry.setValue(valueList.join(", "));
    appendLogEntry(entry);
}