INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
tracer.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://!gearbox.sf.net/ 00004 * Copyright (c) 2004-2010 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 GBXUTILACFR_TRACER_H 00012 #define GBXUTILACFR_TRACER_H 00013 00014 #if defined (WIN32) 00015 #if defined (GBXUTILACFR_STATIC) 00016 #define GBXUTILACFR_EXPORT 00017 #elif defined (GBXUTILACFR_EXPORTS) 00018 #define GBXUTILACFR_EXPORT __declspec (dllexport) 00019 #else 00020 #define GBXUTILACFR_EXPORT __declspec (dllimport) 00021 #endif 00022 #else 00023 #define GBXUTILACFR_EXPORT 00024 #endif 00025 00026 #include <string> 00027 00028 namespace gbxutilacfr { 00029 00031 enum TraceType { 00033 InfoTrace=0, 00035 WarningTrace, 00037 ErrorTrace, 00039 DebugTrace, 00042 AnyTrace, 00044 NumberOfTraceTypes, 00045 }; 00046 00048 GBXUTILACFR_EXPORT std::string toString( TraceType type ); 00049 00051 enum DestinationType { 00053 ToDisplay=0, 00055 ToNetwork, 00057 ToLog, 00059 ToFile, 00062 ToAny, 00064 NumberOfDestinationTypes 00065 }; 00066 00111 class GBXUTILACFR_EXPORT Tracer 00112 { 00113 public: 00114 virtual ~Tracer() {}; 00115 00116 struct Config 00117 { 00119 int verbosity[NumberOfTraceTypes][NumberOfDestinationTypes]; 00121 bool addTimestamp; 00122 }; 00123 00125 00128 virtual void print( const std::string &message ) = 0; 00129 00133 virtual void info( const std::string &message, int level=1, bool localOnly=false ) 00134 { info("",message,level,localOnly); } 00136 virtual void info( const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false ) = 0; 00137 00141 virtual void warning( const std::string &message, int level=1, bool localOnly=false ) 00142 { warning("",message,level,localOnly); } 00144 virtual void warning( const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false ) = 0; 00145 00149 virtual void error( const std::string &message, int level=1, bool localOnly=false ) 00150 { error("",message,level,localOnly); } 00152 virtual void error( const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false ) = 0; 00153 00157 virtual void debug( const std::string &message, int level=1, bool localOnly=false ) 00158 { debug("",message,level,localOnly); } 00160 virtual void debug( const std::string &subsystem, const std::string &message, int level=1, bool localOnly=false ) = 0; 00161 00167 virtual int verbosity( TraceType traceType, DestinationType destType=ToAny ) const = 0; 00168 00171 virtual void setSubsystemDebugLevel( const std::string &subsystem, int level=0 ) {}; 00172 00176 virtual void subsystemDebug( const std::string &subsystem, const std::string &message, int level=1 ) 00177 { 00178 debug( message, level ); 00179 }; 00180 }; 00181 00182 } 00183 00184 #endif |