00001 #ifndef __logger_h__ 00002 #define __logger_h__ 00003 00004 #ifdef HAVE_UNISTD_H 00005 #include <unistd.h> 00006 #endif 00007 00008 #include <iostream> 00009 #include <string> 00010 00011 #include "asserts.h" 00012 #include "types.h" 00013 #include "fs.h" 00014 #include "rconfig.h" 00015 00016 /** Write information to a log file */ 00017 class log_manager { 00018 public: 00019 log_manager(); 00020 00021 void clear(void); 00022 void init(void); 00023 const bool initialized(void) const; 00024 00025 void write( 00026 const std::string& a_str, 00027 const uint16 a_indention = 0, 00028 const configuration_manager::logging_type a_logging_level 00029 = configuration_manager::logging_manager, 00030 const pid_t a_pid = pid() 00031 ); 00032 00033 void set_error_logging(bool a_b); 00034 00035 private: 00036 bool m_new_line; 00037 std::ofstream m_out; 00038 bool m_initialized; 00039 bool m_use_error_logging_level; 00040 }; 00041 00042 extern log_manager logger; 00043 00044 #endif