23 #include <QtCore/QByteArray> 24 #include <QtCore/QStringList> 25 #include <QtSql/QSqlError> 26 #include <QtSql/QSqlQuery> 41 m_db = QSqlDatabase::addDatabase(
"QSQLITE");
42 m_db.setDatabaseName(db_filename);
45 bool log_entries_exists =
false;
46 foreach(QString table,
m_db.tables(QSql::AllTables))
48 if (table ==
"log_entries")
50 log_entries_exists =
true;
53 if (!log_entries_exists)
55 m_db.exec(
"CREATE TABLE log_entries (" 57 "timestamp TEXT, timestamp_ns INTEGER, " 58 "log_level TEXT, log_stream TEXT, " 59 "file TEXT, line INTEGER, " 60 "class TEXT, object TEXT, function TEXT, " 75 m_udp_socket->readDatagram(datagram.data(), datagram.size());
77 QString sql =
"INSERT INTO log_entries VALUES (";
78 sql.append(datagram.data());
void processPendingDatagrams()
virtual ~UdpLoggingServer()
QUdpSocket * m_udp_socket
UdpLoggingServer(const QString &db_filename)