INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
tracerlogwriter.h00001 #ifndef HYDROICEUTIL_TRACERLOGWRITER_H 00002 #define HYDROICEUTIL_TRACERLOGWRITER_H 00003 00004 #include <hydroiceutil/detail/syslogger.h> 00005 #include <hydroiceutil/detail/logcompressor.h> 00006 #include <map> 00007 00008 namespace hydroiceutil { 00009 namespace detail { 00010 00011 // 00012 // @brief Handles writing tracer information to a log (e.g. syslog in UNIX). 00013 // 00014 // Does some compression: compresses repeated messages into 00015 // "Last message repeated XXX times" messages. syslogd does 00016 // this for us anyway, but it can't handle the case where 00017 // multiple components interleave repeated messages. Also, 00018 // within a single component we have to deal with the case 00019 // where multiple subsystems interleave repeated messages. 00020 // This class is designed to handle these cases. 00021 // 00022 // @author Alex Brooks 00023 // 00024 class TracerLogWriter 00025 { 00026 public: 00027 00028 TracerLogWriter( const std::string &compName, bool isApp ); 00029 00030 void logDebug( const std::string &msg, const std::string &subsystem="" ) { log(SysLogger::Debug,msg,subsystem); } 00031 void logInfo( const std::string &msg, const std::string &subsystem="" ) { log(SysLogger::Info,msg,subsystem); } 00032 void logNotice( const std::string &msg, const std::string &subsystem="" ) { log(SysLogger::Notice,msg,subsystem); } 00033 void logWarning( const std::string &msg, const std::string &subsystem="" ) { log(SysLogger::Warning,msg,subsystem); } 00034 void logError( const std::string &msg, const std::string &subsystem="" ) { log(SysLogger::Error,msg,subsystem); } 00035 00036 private: 00037 00038 void log( SysLogger::LogPriority priority, 00039 const std::string &msg, 00040 const std::string &subsystem = "" ); 00041 00042 SysLogger sysLogger_; 00043 00044 // Indexed by subsystem 00045 std::map<std::string,LogCompressor> logCompressors_; 00046 }; 00047 00048 } 00049 } 00050 00051 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)