Beispiel #1
0
// -----------------------------------------------------------------------------
void hub::on_commit_fuse(LogEntry entry) {
  if (!entry.acked_by_quorum()) return;

  auto new_graph = acks_to_graph(entry.acks);
  _broadcast_routing_table->recalculate(new_graph);

  LOG("Commit config: ", entry.message_id(), ": ", new_graph);

  ASSERT(!_configs.empty());
  auto prev_quorum = _configs.rbegin()->second;
  Diff diff(prev_quorum, entry.quorum);

  _configs.emplace(entry.message_id(), std::move(entry.quorum));

  // Forget about the lost nodes
  for (auto id : diff.removed) {
    _seen->forget_messages_from_user(id);
    _nodes.erase(id);
  }

  if (!diff.added.empty()) {
    if (destroys_this([&]() { _callbacks->on_insert(move(diff.added)); })) {
      return;
    }
  }

  if (!diff.removed.empty()) {
    if (destroys_this([&]() { _callbacks->on_remove(move(diff.removed)); })) {
      return;
    }
  }
}
Beispiel #2
0
	void Log::clear(UINT32 channel)
	{
		RecursiveLock lock(mMutex);

		Vector<LogEntry> newEntries;
		for(auto& entry : mEntries)
		{
			if (entry.getChannel() == channel)
				continue;

			newEntries.push_back(entry);
		}

		mEntries = newEntries;

		Queue<LogEntry> newUnreadEntries;
		while (!mUnreadEntries.empty())
		{
			LogEntry entry = mUnreadEntries.front();
			mUnreadEntries.pop();

			if (entry.getChannel() == channel)
				continue;

			newUnreadEntries.push(entry);
		}

		mUnreadEntries = newUnreadEntries;
		mHash++;
	}
Beispiel #3
0
int LogTester::NextErrorCode()
{
	LogEntry le;
	while(mBuffer.ReadLog(le))
	{		
		if(le.GetErrorCode() >= 0) return le.GetErrorCode();
	}
	return -1;
}
Beispiel #4
0
bool LogManager::Truncate(uint64_t index,uint64_t term){
	abb::Mutex::Locker l(mtx_);
	LOG(TRACE) << "log.truncate: " <<  index;
	if(index < this->commit_index_){
		LOG(DEBUG) << "log.truncate.before";
		return false;
	}
	if(index > (log_entry_arr_.size() + start_index_)){
		LOG(DEBUG) << "log.truncate.after" << index << ":"<< log_entry_arr_.size() << "+" << start_index_ << "commit_index:" << commit_index_;
		return false;
	}
	if(index == this->start_index_){
		lseek(fd_,0, SEEK_SET);
		ftruncate(fd_,0);
		for(unsigned st=0;st < this->log_entry_arr_.size() ;st++){
			LogEntry* entry = log_entry_arr_[st];
			if(entry->ev_){
				if(entry->ev_){
					entry->ev_->Notify(NULL,"command failed to be committed due to node failure");
					entry->ev_->UnRef();
					entry->ev_ = NULL;
				}
				entry->UnRef();
			}
		}
		this->log_entry_arr_.clear();
	}else{
		if(index < (this->start_index_+this->log_entry_arr_.size()) ){
			int st = index - this->start_index_ -1;
			LogEntry* entry = this->log_entry_arr_[st];
			if (this->log_entry_arr_.size()> 0 && entry->term_ != term ){
				LOG(DEBUG) << "log.truncate.termMismatch";
				return false;
			}else{
				int start = index - this->start_index_;
				LogEntry* entry = this->log_entry_arr_[start];
				ftruncate(fd_,entry->position);
				lseek(fd_,entry->position, SEEK_SET);
				for(int i=start;i < (int)this->log_entry_arr_.size();i++){
					LogEntry* inentry = this->log_entry_arr_[i];
					if(inentry){
						if(inentry->ev_){
							inentry->ev_->Notify(NULL,"command failed to be committed due to node failure");
							inentry->ev_->UnRef();
							inentry->ev_ = NULL;
						}
						inentry->UnRef();
					}
				}
				this->log_entry_arr_.erase(this->log_entry_arr_.begin()+start,this->log_entry_arr_.end());
				LOG(DEBUG) << "log.truncate.success" << this->start_index_  << "/" << this->log_entry_arr_.size();
			}
		}
	}
	return true;
}
Beispiel #5
0
int LogTester::ClearLog()
{
	int max = -1;
	LogEntry le;
	while(mBuffer.ReadLog(le)) {
		if(le.GetErrorCode() > max) max = le.GetErrorCode();
	}

	return max;
}
Beispiel #6
0
int LogTester::ClearLog()
{
	int max = -1;
	LogEntry le;
	while(!mBuffer.empty()) {		
		if(mBuffer.front().GetErrorCode() > max) max = le.GetErrorCode();
		mBuffer.pop();
	}

	return max;
}
Beispiel #7
0
int LogTester::NextErrorCode()
{
	LogEntry le;
	while(!mBuffer.empty()) {
		le = mBuffer.front();
		mBuffer.pop();
		if(le.GetErrorCode() >= 0) {						
			return le.GetErrorCode();
		}
	}
	return -1;
}
Beispiel #8
0
void Datastore::testWrite(int n)
{
    LogEntry le;
    for (int i = 0; i < n; i++)
    {
        le.setPressure( i + 1 );
        le.setTemperature( 2 * i + 1 );
        le.setBattery( 0.1 * (double)(i + 1) );
//    le.print();
        addEntry(&le);
    }
    addFileEndMarker();
}
Beispiel #9
0
void LogWindow::addLogEntry(const LogEntry &entry)
{
    QString entryType;
    QTextCharFormat *entryFormat;
    switch (entry.entryType()) {
    case LogEntry::DebugMessage:
        entryType = tr("Debug");
        entryFormat = m_debugMessageFormat;
        break;
    case LogEntry::Notification:
        entryType = tr("Notification");
        entryFormat = m_notificationFormat;
        break;
    case LogEntry::Warning:
        entryType = tr("Warning");
        entryFormat = m_warningFormat;
        break;
    case LogEntry::Error:
        entryType = tr("Error");
        entryFormat = m_errorFormat;
        break;
    default:
        entryType = tr("LogEntry");
        entryFormat = m_debugMessageFormat;
    }

    QTextDocument *doc = m_log->document();
    QTextCursor cur(doc);
    cur.beginEditBlock();
    cur.movePosition(QTextCursor::Start);
    cur.insertBlock(*m_logEntryBlockFormat);
    cur.insertText(entry.timeStamp().toString("[yyyy-MM-dd hh:mm:ss]"),
                   *m_timeStampFormat);
    cur.insertText(" ");
    cur.insertText(QString("%1").arg(entryType, -12), *entryFormat);
    cur.insertText(" ");
    if (entry.moleQueueId() == InvalidId) {
        cur.insertText(tr("Job %1").arg("N/A", -6), *m_moleQueueIdFormat);
    }
    else {
        cur.insertText(tr("Job %1").arg(entry.moleQueueId(), -6),
                       *m_moleQueueIdFormat);
    }
    cur.insertText(" ");
    // Modify newlines to align with the hanging indent.
    cur.insertText(entry.message().replace(QRegExp("\\n+"), "\n  "),
                   *m_messageFormat);
    cur.endEditBlock();
}
Beispiel #10
0
bool LogManager::Open(const std::string& path){
	path_ = path;
	abb::Mutex::Locker l(mtx_);
	fd_ = open(path.c_str(),O_RDWR,0600);
	if(fd_ < 0){
		LOG(WARN)<< "raft.open.file.failed:"<<path<< " err:" <<errno<<" errstr:" << strerror(errno);
		fd_ = open(path.c_str(),O_RDWR|O_CREAT,0600);
		if(fd_ < 0){
			LOG(WARN)<< "raft.create.file.failed:"<<path<< " err:" <<errno<<" errstr:" << strerror(errno);
			return false;
		}
		LOG(DEBUG)<< "log.open.create " << path;
		return true;
	}
	fcntl(fd_, F_SETFD, FD_CLOEXEC);
	LOG(DEBUG)<< "log.open.exist " << path;
	lseek(fd_,0,SEEK_SET);
	abb::Buffer buf;
	while( buf.WriteFromeReader(StaticReader,this) > 0){
		;
	}
	int position = 0;
	int size = buf.ReadSize();
	while(size > 0){
		LogEntry* entry = new LogEntry();
		if( ! entry->Decode(buf) ) {
			entry->UnRef();
			return false;
		}

		entry->position = position;
		if(entry->index_ > this->start_index_){
			entry->Ref();
			this->log_entry_arr_.push_back(entry);
			if(entry->index_ <= this->commit_index_){
				entry->cmd_->Apply(this->svr_,NULL,NULL);
			}
		}
		position += size - buf.ReadSize();
		entry->UnRef();
		size = buf.ReadSize();
	}
	if(this->log_entry_arr_.size() > 0){
		LOG(DEBUG) << "open.log.append log index " << this->log_entry_arr_.front()->index_ << ":" <<this->log_entry_arr_.back()->index_ << "  " << this->commit_index_;
	}
	
	return true;
}
Beispiel #11
0
bool LogAnalyser::hasValidExtension ( LogEntry& logEntry )
{
	// L'extension est valide si on n'arrive pas à la trouver dans
	// la liste des extensions exclues
	return find( EXCLUDE_LIST.begin( ), EXCLUDE_LIST.end( ),
			logEntry.GetUriExtension( ) ) == EXCLUDE_LIST.end( );
} //----- Fin de hasValidExtension
Beispiel #12
0
void
GetX509CertLogEntry(LogEntry& entry)
{
  entry.Reset();
  entry.type = ct::LogEntry::Type::X509;
  entry.leafCertificate = HexToBytes(kDefaultDerCert);
}
Beispiel #13
0
	/** 
	open, write, close the file rather than hold it forever so it can handle having
	the file deleted from underneath it without failing. 
	*/
	void LogToFile :: PushItemsToFile()
	{
		try {				
			std::ofstream file(mFileName.c_str(), std::ios::app | std::ios::out);
			if(!file.is_open()) std::cerr << "Failure to open: " << mFileName << std::endl;
			
			LogEntry le;
			while(ReadLog(le)) file << le.LogString() << std::endl;
			
			file << std::flush;
			if(file.bad()) std::cerr << "Failure during writing log file: " << file.rdstate() << std::endl;				
			file.close();					
		}
		catch(std::exception e){
			std::cerr << "Error during LogToFile: " << e.what() << std::endl;
		}
	}
Beispiel #14
0
void
GetPrecertLogEntry(LogEntry& entry)
{
  entry.Reset();
  entry.type = ct::LogEntry::Type::Precert;
  entry.issuerKeyHash = HexToBytes(kDefaultIssuerKeyHash);
  entry.tbsCertificate = HexToBytes(kDefaultDerTbsCert);
}
Beispiel #15
0
VXIlogResult OSBlog::ErrorLog(const VXIchar*   moduleName,
                              VXIunsigned      errorID,
                              const VXIchar*   format,
                              va_list          args)
{
    const VXIchar *finalModuleName =
        (moduleName && moduleName[0] ? moduleName : L"UNKNOWN");

    // Output the log message
    LogEntry entry;
    entry.AddEntrySep();
    entry += channelNum;
    entry.AddEntrySep();
    entry += finalModuleName;
    entry.AddEntrySep();
    entry += errorID;
    entry.AddEntrySep();
    VXIlogResult rc = entry.AppendKeyValueVa(format, args);
    entry.Terminate();

    VXIlogResult rc2 = WriteEntry(entry);
    if (rc2 != VXIlog_RESULT_SUCCESS)
        rc = rc2;

    // Want to warn the caller that NULL moduleName really isn't OK, but
    // logged it anyway
    if ((! moduleName) || (! moduleName[0]))
        rc = VXIlog_RESULT_INVALID_ARGUMENT;

    return rc;
}
Beispiel #16
0
void StdLogOutput::print(const LogEntry &entry)
{
    //const QString timestamp(entry.timestamp().toString("yy-MM-dd::hh:mm:ss"));
    const QString timestamp(entry.timestamp().toString("hh:mm:ss"));

    switch(entry.type())
    {
    case LogEntry::DEBUG_LOG:
        std::cout << QString("%1 %2 %3: %4").arg(timestamp).arg(entry.file()).arg(entry.line()).arg(entry.message()).toStdString() << std::endl;
        break;
    case LogEntry::ERROR_LOG:
        std::cout << QString("%1 error: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
        break;
    case LogEntry::INFORMATION_LOG:
    case LogEntry::MESSAGE_LOG:
    case LogEntry::WORKFLOW_LOG:
        std::cout << QString("%1: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
        break;
    case LogEntry::WARNING_LOG:
        std::cout << QString("%1 warning: %2").arg(timestamp).arg(entry.message()).toStdString() << std::endl;
        break;
    case LogEntry::EMPTYLINE_LOG:
        std::cout << std::endl << std::endl;
        break;
    case LogEntry::UNDEFINED_LOG:
    default:
        break;
    }
}
Beispiel #17
0
void FileLogOutput::print(const LogEntry &entry)
{
    const QString timestamp(entry.timestamp().toString("yy-MM-dd::hh:mm:ss"));
    //const QString timestamp(entry.timestamp().toString("hh:mm:ss"));

    switch(entry.type())
    {
    case LogEntry::INFORMATION_LOG:
        (*m_stream) << QString("%1:         %2\n").arg(timestamp).arg(entry.message());
        break;
    case LogEntry::WORKFLOW_LOG:
        (*m_stream) << QString("%1:       f %2\n").arg(timestamp).arg(entry.message());
        break;
    case LogEntry::WARNING_LOG:
        (*m_stream) << QString("%1 warning: %2\n").arg(timestamp).arg(entry.message());
        break;
    case LogEntry::ERROR_LOG:            
        (*m_stream) << QString("%1 error:   %2\n").arg(timestamp).arg(entry.message());
        break;
    case LogEntry::DEBUG_LOG:            
        (*m_stream) << QString("%1 %2 %3: %4\n").arg(timestamp).arg(entry.file()).arg(entry.line()).arg(entry.message());
        break;
    case LogEntry::EMPTYLINE_LOG:
        (*m_stream) << "\n";
        break;
    case LogEntry::MESSAGE_LOG:    
    case LogEntry::UNDEFINED_LOG:
    default:
        break;
    };

    m_stream->flush();
}
Beispiel #18
0
void EventLog::Log( const LogEntry& arEntry )
{
	SubscriberMap::iterator i = mSubscribers.begin();
	for(; i != mSubscribers.end(); ++i) {
		if(this->SetContains(i->second, -1) || this->SetContains(i->second, arEntry.GetErrorCode())) {
			i->first->Log(arEntry);
		}
	}
}
Beispiel #19
0
bool LogSink::willAccept(LogEntry const &entry) const
{
    switch (_mode)
    {
    case Enabled:
        return true;

    case Disabled:
        return false;

    case OnlyNormalEntries:
        return entry.level() < LogEntry::Warning;

    case OnlyWarningEntries:
        return entry.level() >= LogEntry::Warning;
    }
    return false;
}
Beispiel #20
0
/**
open, write, close the file rather than hold it forever so it can handle having
the file deleted from underneath it without failing.
*/
void LogToFile :: PushItemsToFile()
{
	try {
		// we need to open file in append mode first time only
		std::ofstream file(mFileName.c_str(), mOverwriteFile ? (std::ios::out) : (std::ios::app | std::ios::out));
		if(!file.is_open()) std::cerr << "Failure to open: " << mFileName << std::endl;

		mOverwriteFile = false;

		LogEntry le;
		while(ReadLog(le)) file << le.LogString() << std::endl;

		file << std::flush;
		if(file.bad()) std::cerr << "Failure during writing log file: " << file.rdstate() << std::endl;
		file.close();
	}
	catch(std::exception e) {
		std::cerr << "Error during LogToFile: " << e.what() << std::endl;
	}
}
Beispiel #21
0
void Log::append(LogEntry::e_LogEntryType type, const QString &message, const bool debug)
{
    LogEntry *entry = new LogEntry(type, message);

    if(debug)
    {
        entry->setFile(m_debug_file);
        entry->setLine(m_debug_line);
    }

    if(m_dispatcher)
    {
        m_dispatcher->append(*entry);
        delete entry;
    }
    else
    {
        // Cache items.
        m_earlyEntries << entry;
    }
}
Beispiel #22
0
/*
  put the log entry into the right place.
 */
void JavaPlainLog::AddLogEntryToMap(LogEntry &entry)
{
#if kLAPerformance && kLADebug
    __int64 pStart = 0, pEnd = 0;
    pStart = PerformanceCounter();
#endif
    map<string, vector<LogEntry> >::iterator mitr;
    // find out whether the give address is in the map.
    mitr = _addresses.find(entry.GetAddress());

    if (mitr == _addresses.end())
    {
        vector<LogEntry> entries;
        entry.SetTotalOrderNum(1);
        entries.push_back(entry);
        _addresses.insert(pair<string, vector<LogEntry> >(entry.GetAddress(), entries));
    }
    else
    {
        entry.SetTotalOrderNum(_addresses[entry.GetAddress()].size()+1);
        _addresses[entry.GetAddress()].push_back(entry);
    }

#if kLAPerformance && kLADebug
    pEnd = PerformanceCounter();
    EZLOGGERPRINT("Takes %g ms.", (pEnd-pStart)/PCPerformanceFreq());
#endif
}
LogSink::IFormatter::Lines StyledLogSinkFormatter::logEntryToTextLines(LogEntry const &entry)
{
    LogEntry::Flags flags = LogEntry::Styled | LogEntry::OmitLevel;

#ifndef _DEBUG
    // No metadata in release builds.
    flags |= LogEntry::Simple;
#endif

    // This will form a single long line. The line wrapper will
    // then determine how to wrap it onto the available width.
    return Lines() << entry.asText(flags);
}
Beispiel #24
0
VXIlogResult OSBlog::WriteEntry(const LogEntry &entry, bool logToStdout)
{
    if (((! gblLogFile) && (! gblLogToStdout)) || (entry.size() < 1))
        return VXIlog_RESULT_SUCCESS;

    // Convert to narrow characters
    unsigned int i;
    unsigned int n = entry.size();
    const wchar_t *ptr = entry.Entry();
    char outbuf[MAX_LOG_BUFFER];
    for(i=0; i<n; i++)
        outbuf[i] = w2c(ptr[i]);
    outbuf[i] = '\0';

    // Lock and write out the log entry
    if (VXItrdMutexLock(gblLogMutex) != VXItrd_RESULT_SUCCESS)
        return VXIlog_RESULT_SYSTEM_ERROR;

    VXIlogResult rc = VXIlog_RESULT_SUCCESS;
    if (gblLogFile) {
        if (fwrite(outbuf, sizeof(char), n, gblLogFile) < 1) {
            // should disable logging.
            rc = VXIlog_RESULT_IO_ERROR;
        } else {
            // to ensure we don't lose log lines on a crash/abort
            fflush(gblLogFile);
        }
    }

    if (gblLogToStdout && logToStdout &&
            (fwrite(outbuf, sizeof(char), n, stdout) < 1 || fflush(stdout) != 0))
        rc = VXIlog_RESULT_IO_ERROR;

    if (VXItrdMutexUnlock(gblLogMutex) != VXItrd_RESULT_SUCCESS)
        rc = VXIlog_RESULT_SYSTEM_ERROR;

    return rc;
}
Beispiel #25
0
void Logger::handleNewLogEntry(LogEntry &entry)
{
  entry.setTimeStamp();
  m_log.push_back(entry);

  trimLog();

  switch (entry.entryType()) {
  case LogEntry::DebugMessage:
    handleNewDebugMessage(entry);
    break;
  case LogEntry::Notification:
    handleNewNotification(entry);
    break;
  case LogEntry::Warning:
    handleNewWarning(entry);
    break;
  case LogEntry::Error:
    handleNewError(entry);
    break;
  }
  emit newLogEntry(entry);
}
Beispiel #26
0
bool LogManager::CommitToIndex(uint64_t index){
	LogEntryArray arr;
	{
		LOG(TRACE) << "CommitToIndex" << index;
		abb::Mutex::Locker l(mtx_);
		if(index > (log_entry_arr_.size() + start_index_)){
			LOG(DEBUG) << "raft.Log: Commit index" << index << "set back to " << ( log_entry_arr_.size() + start_index_);
			index = log_entry_arr_.size() + start_index_;
		}
		if (index < commit_index_) {
			LOG(DEBUG) << "raft.Log: Commit index earily :" << index << "commit_index_:" << commit_index_;
			return true;
		}
		for(unsigned i= this->commit_index_+1;i<=index;i++){
			int e_index = i - 1 - this->start_index_;
			LogEntry* entry = log_entry_arr_[e_index];
			this->commit_index_ = entry->index_;
			entry->Ref();
			arr.push_back(entry);
		}
	}
	for(unsigned i = 0;i< arr.size();i++){
		LogEntry* entry = arr[i];
		if(entry->ev_){
			IMessage* msg = NULL;
			std::string error ;
			entry->cmd_->Apply(this->svr_,&error,&msg);
			entry->ev_->Notify(msg,error);
			entry->ev_->UnRef();
			entry->ev_ = NULL;
		}else{
			entry->cmd_->Apply(this->svr_,NULL,NULL);
		}
		entry->UnRef();
	}
	return true;
}
Beispiel #27
0
void ConsoleOutput::process_entry(const LogEntry& e)
{
	if (e)
	{
		std::ostream& o = (e.get_level() <= LogLevel::LogLevel_DEPRECATED) ? std::cout : std::cerr;
		internal::add_color(o,e.get_level()) << termcolor::bold;
		o << "[" << internal::loglevel_to_string(e.get_level()) << "]" << termcolor::reset;
		if (!e.get_sender().empty())
		{
			o << '(' << termcolor::magenta << e.get_sender() << termcolor::reset << ')';
		}
		o << ": " << e.get_message_str();
		if (e.get_level() >= LogLevel::LogLevel_DEBUG && !e.get_fileinfo().empty())
		{
			o << " (file " << termcolor::magenta;
			o << e.get_fileinfo() << termcolor::reset << ')';
		}
		o << std::endl;
	}
}
Beispiel #28
0
void LogEngine::appendLogEntry(const LogEntry &entry)
{
    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().toMSecsSinceEpoch())
            .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;
    query.exec(queryString);

    if (query.lastError().isValid()) {
        qCWarning(dcLogEngine) << "Error writing log entry. Driver error:" << query.lastError().driverText() << "Database error:" << query.lastError().databaseText();
    }
}
Beispiel #29
0
bool LogManager::AppendEntries(LogEntryArray entries,std::string* save_err){
	abb::Mutex::Locker l(mtx_);
	for(unsigned i=0;i<entries.size();i++){
		LogEntry* entry = entries[i];
		if(this->log_entry_arr_.size() > 0){
			LogEntry* last_entry = this->log_entry_arr_.back();
			if(last_entry->term_ > entry->term_){
				LOG(DEBUG) << "Cannot Append entry with earlier term last:" << last_entry->term_ << "insert:" << entry->term_;
				if(save_err) *save_err = "Cannot Append entry with earlier term";
				return false;
			}else if(last_entry->term_ == entry->term_ && entry->index_ < last_entry->index_){
				LOG(DEBUG) << "Cannot Append entry with earlier index in same term last:" << last_entry->index_ << "insert:" << entry->index_;
				if(save_err) *save_err = "Cannot Append entry with earlier index";
				return false;
			}
		}
		entry->Ref();
		WriteEntry(fd_,entry);
		this->log_entry_arr_.push_back(entry);
	}
	if(entries.size() > 0)
		fsync(fd_);
	return true;
}
Beispiel #30
0
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);
}