00001
00002
00003
00004
00005 #ifndef MODULE_LOG_H
00006 #define MODULE_LOG_H
00007
00008 #include "module.h"
00009 #include <queue>
00010 #include <list>
00011 #include <fstream>
00012
00013 using namespace std;
00014
00015 class module_log : public module
00016 {
00017 public:
00018
00019 int get_status( void )
00020 {
00021 return( 0 );
00022 }
00023
00026 int handle_msg( const char* msg );
00027
00028 int mod_load( void );
00029
00030 int mod_unload( void );
00031
00033 char* get_name( void )
00034 {
00035 return( "module_log" );
00036 }
00037
00039 int get_msg_number( void )
00040 {
00041 return cache.size();
00042 }
00043
00046 string get_oldest_msg( void )
00047 {
00048 string tmp;
00049 if( !cache.empty() )
00050 {
00051 tmp = cache.front();
00052 tmp.erase( 0, 1 );
00053 cache.pop();
00054 }
00055 return tmp;
00056 }
00057
00058 private:
00059
00060 ofstream log_file;
00061 queue<string> cache;
00062 };
00063
00064 #endif
00065