Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00026
00027 #ifndef ICL_CORE_LOGGING_SQLITE_LOG_DB_H_INCLUDED
00028 #define ICL_CORE_LOGGING_SQLITE_LOG_DB_H_INCLUDED
00029
00030 #include <sqlite3.h>
00031
00032 #include <icl_core/TimeStamp.h>
00033
00034 namespace icl_core {
00035 namespace logging {
00036
00037 class SQLiteLogDb
00038 {
00039 public:
00040 SQLiteLogDb(const icl_core::String& db_filename, bool rotate);
00041 ~SQLiteLogDb();
00042
00043 void openDatabase();
00044 void closeDatabase();
00045 void writeLogLine(const char *app_id, const char *timestamp,
00046 const char *log_stream, const char *log_level, const char *filename,
00047 size_t line, const char *class_name, const char *object_name,
00048 const char *function_name, const char *message_text);
00049
00050 private:
00051 icl_core::String m_db_filename;
00052 sqlite3 *m_db;
00053 sqlite3_stmt *m_insert_stmt;
00054
00055 bool m_rotate;
00056 int64_t m_last_rotation;
00057
00058 static icl_core::String m_create_sql;
00059 static icl_core::String m_insert_sql;
00060 };
00061
00062 }
00063 }
00064
00065 #endif