예제 #1
0
파일: logengine.cpp 프로젝트: haklein/guh
void LogEngine::logSystemEvent(bool active, Logging::LoggingLevel level)
{
    LogEntry entry(level, Logging::LoggingSourceSystem);
    entry.setActive(active);
    appendLogEntry(entry);
    emit logEntryAdded(entry);
}
예제 #2
0
파일: logengine.cpp 프로젝트: haklein/guh
void LogEngine::logRuleTriggered(const Rule &rule)
{
    LogEntry entry(Logging::LoggingSourceRules);
    entry.setTypeId(rule.id());
    appendLogEntry(entry);
    emit logEntryAdded(entry);
}
예제 #3
0
파일: logengine.cpp 프로젝트: haklein/guh
void LogEngine::logRuleActiveChanged(const Rule &rule)
{
    LogEntry entry(Logging::LoggingSourceRules);
    entry.setTypeId(rule.id());
    entry.setActive(rule.active());
    appendLogEntry(entry);
    emit logEntryAdded(entry);
}
예제 #4
0
파일: logengine.cpp 프로젝트: haklein/guh
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);
    emit logEntryAdded(entry);
}
예제 #5
0
void Logger::addEntry(QString errorMessage) {
    QString ss;
    _strdate(m_dateStr);
    _strtime(m_timeStr);
    ss.append(m_dateStr);
    ss.append(" - ");
    ss.append(m_timeStr);
    ss.append(": ");
    ss.append(errorMessage);
    SLoggerLock->lock();
    logEntries->push_back(ss);
    SLoggerLock->unlock();
    emit logEntryAdded();
}
예제 #6
0
DlgViewLog::DlgViewLog(QWidget *parent) : QDialog(parent)
{


    logArea = new QPlainTextEdit;
    logArea->setReadOnly(true);
    
    auto *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(logArea);

    coClearLog = new QCheckBox;
    coClearLog->setText(tr("Clear log when closing"));
    coClearLog->setChecked(settingsCache->servers().getClearDebugLogStatus(true));
    connect(coClearLog, SIGNAL(toggled(bool)), this, SLOT(actCheckBoxChanged(bool)));
    mainLayout->addWidget(coClearLog);

    setLayout(mainLayout);

    setWindowTitle(tr("Debug Log"));
    resize(800, 500);

    loadInitialLogBuffer();
    connect(&Logger::getInstance(), SIGNAL(logEntryAdded(QString)), this, SLOT(logEntryAdded(QString)));    
}
예제 #7
0
파일: logengine.cpp 프로젝트: haklein/guh
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);
    emit logEntryAdded(entry);
}
예제 #8
0
파일: logengine.cpp 프로젝트: defc0n1/guh
void LogEngine::appendLogEntry(const LogEntry &entry)
{
    checkDBSize();

    QString queryString = QString("INSERT INTO entries (timestamp, loggingEventType, loggingLevel, sourceType, typeId, deviceId, value, active, errorCode) values ('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9');")
            .arg(entry.timestamp().toTime_t())
            .arg(entry.eventType())
            .arg(entry.level())
            .arg(entry.source())
            .arg(entry.typeId().toString())
            .arg(entry.deviceId().toString())
            .arg(entry.value())
            .arg(entry.active())
            .arg(entry.errorCode());

    QSqlQuery query;
    if (!query.exec(queryString)) {
        qCWarning(dcLogEngine) << "Error writing log entry. Driver error:" << query.lastError().driverText() << "Database error:" << query.lastError().databaseText();
        qCWarning(dcLogEngine) << entry;
        return;
    }

    emit logEntryAdded(entry);
}
예제 #9
0
void DlgViewLog::loadInitialLogBuffer()
{
    QList<QString> logBuffer = Logger::getInstance().getLogBuffer();
    foreach(QString message, logBuffer)
        logEntryAdded(message);
}