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
|
syslogger.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef HYDROICEUTIL_SYSLOGGER_H 00012 #define HYDROICEUTIL_SYSLOGGER_H 00013 00014 #include <string> 00015 00016 namespace hydroiceutil { 00017 00018 namespace detail { 00019 00020 // 00021 // Logs things to syslog under UNIX, or the Event Log under Windows. 00022 // Currently, only the UNIX side is implemented. 00023 // 00024 // Not intended for use directly by libOrcaIce users, but rather internally in libOrcaIce. 00025 // 00026 // @author Alex Brooks 00027 // 00028 class SysLogger 00029 { 00030 00031 public: 00032 00033 enum LogPriority { 00034 Debug, 00035 Info, 00036 Notice, 00037 Warning, 00038 Error, 00039 }; 00040 00041 SysLogger( const std::string &compName, bool isApp ); 00042 ~SysLogger(); 00043 00044 void logDebug( const std::string &msg ) { log( Debug, msg ); } 00045 void logInfo( const std::string &msg ) { log( Info, msg ); } 00046 void logNotice( const std::string &msg ) { log( Notice, msg ); } 00047 void logWarning( const std::string &msg ) { log( Warning, msg ); } 00048 void logError( const std::string &msg ) { log( Error, msg ); } 00049 00050 // Allow setting priority as a parameter 00051 void log( LogPriority priority, const std::string &msg ); 00052 00053 private: 00054 00055 const std::string compName_; 00056 const bool isApp_; 00057 }; 00058 00059 // Non-member functions 00060 std::string toPriorityString( SysLogger::LogPriority priority ); 00061 00062 } // namespace 00063 } // namespace 00064 00065 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)