SQLiteLogDb.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
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


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:24