Changeset 51
- Timestamp:
- 01/23/05 07:25:27 (19 years ago)
- Files:
-
- trunk/freebob/src/debugmodule.cpp (modified) (9 diffs)
- trunk/freebob/src/debugmodule.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/debugmodule.cpp
r43 r51 43 43 44 44 void 45 DebugStandard:: debugError( const char* file,45 DebugStandard::error( const char* file, 46 46 const char* function, 47 47 unsigned int line, … … 57 57 58 58 void 59 DebugStandard:: debugPrint( int level,59 DebugStandard::print( int level, 60 60 const char* file, 61 61 const char* function, … … 74 74 75 75 void 76 DebugStandard:: debugPrintShort( int level,76 DebugStandard::printShort( int level, 77 77 const char* format, ... ) const 78 78 { … … 95 95 96 96 void 97 DebugAnsiColor:: debugError( const char* file,98 99 100 97 DebugAnsiColor::error( const char* file, 98 const char* function, 99 unsigned int line, 100 const char* format, ... ) const 101 101 { 102 102 va_list arg; … … 111 111 112 112 void 113 DebugAnsiColor:: debugPrint( int level,114 115 116 117 113 DebugAnsiColor::print( int level, 114 const char* file, 115 const char* function, 116 unsigned int line, 117 const char* format, ... ) const 118 118 { 119 119 if (level & m_level) { … … 130 130 131 131 void 132 DebugAnsiColor:: debugPrintShort( int level,133 132 DebugAnsiColor::printShort( int level, 133 const char* format, ... ) const 134 134 { 135 135 if (level & m_level) { … … 183 183 184 184 void 185 DebugHtml:: debugError( const char* file,186 187 188 185 DebugHtml::error( const char* file, 186 const char* function, 187 unsigned int line, 188 const char* format, ... ) const 189 189 { 190 190 va_list arg; … … 199 199 200 200 void 201 DebugHtml:: debugPrint( int level,202 203 204 205 201 DebugHtml::print( int level, 202 const char* file, 203 const char* function, 204 unsigned int line, 205 const char* format, ... ) const 206 206 { 207 207 if (level & m_level) { … … 218 218 219 219 void 220 DebugHtml:: debugPrintShort( int level, const char* format, ... ) const220 DebugHtml::printShort( int level, const char* format, ... ) const 221 221 { 222 222 if (level & m_level) { trunk/freebob/src/debugmodule.h
r43 r51 33 33 #define DEBUG_LEVEL_TRANSFERS (1<<5) 34 34 35 #define DEBUG_LEVEL_SCHEDULER (1<<6) 36 35 37 // convenience defines 36 #define DEBUG_LEVEL_ALL (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE | DEBUG_LEVEL_SUBUNIT | DEBUG_LEVEL_DESCRIPTOR | DEBUG_LEVEL_INFOBLOCK | DEBUG_LEVEL_TRANSFERS ) 37 #define DEBUG_LEVEL_LOW (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE) 38 #define DEBUG_LEVEL_MODERATE (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE | DEBUG_LEVEL_SUBUNIT) 39 #define DEBUG_LEVEL_HIGH (DEBUG_LEVEL_MODERATE | DEBUG_LEVEL_DESCRIPTOR | DEBUG_LEVEL_INFOBLOCK) 38 #define DEBUG_LEVEL_ALL ( DEBUG_LEVEL_INFO \ 39 | DEBUG_LEVEL_DEVICE \ 40 | DEBUG_LEVEL_SUBUNIT \ 41 | DEBUG_LEVEL_DESCRIPTOR \ 42 | DEBUG_LEVEL_INFOBLOCK \ 43 | DEBUG_LEVEL_TRANSFERS \ 44 | DEBUG_LEVEL_SCHEDULER ) 45 #define DEBUG_LEVEL_LOW ( DEBUG_LEVEL_INFO \ 46 | DEBUG_LEVEL_DEVICE ) 47 #define DEBUG_LEVEL_MODERATE ( DEBUG_LEVEL_INFO \ 48 | DEBUG_LEVEL_DEVICE \ 49 | DEBUG_LEVEL_SUBUNIT ) 50 #define DEBUG_LEVEL_HIGH ( DEBUG_LEVEL_MODERATE \ 51 | DEBUG_LEVEL_DESCRIPTOR \ 52 | DEBUG_LEVEL_INFOBLOCK ) 40 53 41 54 unsigned char toAscii( unsigned char c ); … … 48 61 virtual ~DebugBase(); 49 62 50 void set DebugLevel( int level )63 void setLevel( int level ) 51 64 { m_level = level; } 52 65 53 virtual void debugError( const char* file, 54 const char* function, 55 unsigned int line, 66 virtual void error( const char* file, 67 const char* function, 68 unsigned int line, 69 const char* format, ... ) const = 0; 70 virtual void print( int level, 71 const char* file, 72 const char* function, 73 unsigned int line, 74 const char* format, ... ) const = 0; 75 virtual void printShort( int level, 56 76 const char* format, ... ) const = 0; 57 virtual void debugPrint( int level,58 const char* file,59 const char* function,60 unsigned int line,61 const char* format, ... ) const = 0;62 virtual void debugPrintShort( int level,63 const char* format, ... ) const = 0;64 77 65 78 protected: … … 72 85 virtual ~DebugStandard(); 73 86 74 virtual void debugError( const char* file, 75 const char* function, 76 unsigned int line, 87 virtual void error( const char* file, 88 const char* function, 89 unsigned int line, 90 const char* format, ... ) const; 91 virtual void print( int level, 92 const char* file, 93 const char* function, 94 unsigned int line, 95 const char* format, ... ) const; 96 virtual void printShort( int level, 77 97 const char* format, ... ) const; 78 virtual void debugPrint( int level,79 const char* file,80 const char* function,81 unsigned int line,82 const char* format, ... ) const;83 virtual void debugPrintShort( int level,84 const char* format, ... ) const;85 98 }; 86 99 … … 90 103 virtual ~DebugAnsiColor(); 91 104 92 virtual void debugError( const char* file, 93 const char* function, 94 unsigned int line, 105 virtual void error( const char* file, 106 const char* function, 107 unsigned int line, 108 const char* format, ... ) const; 109 virtual void print( int level, 110 const char* file, 111 const char* function, 112 unsigned int line, 113 const char* format, ... ) const; 114 virtual void printShort( int level, 95 115 const char* format, ... ) const; 96 virtual void debugPrint( int level, 97 const char* file, 98 const char* function, 99 unsigned int line, 100 const char* format, ... ) const; 101 virtual void debugPrintShort( int level, 102 const char* format, ... ) const; 103 116 104 117 protected: 105 118 const char* getLevelColor( int level ) const; … … 111 124 virtual ~DebugHtml(); 112 125 113 void debugError( const char* file, 114 const char* function, 115 unsigned int line, 126 void error( const char* file, 127 const char* function, 128 unsigned int line, 129 const char* format, ... ) const; 130 void print( int level, 131 const char* file, 132 const char* function, 133 unsigned int line, 134 const char* format, ... ) const; 135 void printShort( int level, 116 136 const char* format, ... ) const; 117 void debugPrint( int level,118 const char* file,119 const char* function,120 unsigned int line,121 const char* format, ... ) const;122 void debugPrintShort( int level,123 const char* format, ... ) const;124 137 125 138 protected: … … 129 142 #ifdef DEBUG 130 143 131 #define setDebugLevel(x) m_debug.setDebugLevel( x ) 132 #define debugError(format, args...) m_debug.debugError( __FILE__, __FUNCTION__, __LINE__, format, ##args ) 133 #define debugPrint(level, format, args...) m_debug.debugPrint( level, __FILE__, __FUNCTION__, __LINE__, format, ##args ) 134 #define debugPrintShort(level, format, args...) m_debug.debugPrintShort( level, format, ##args ) 144 #define setDebugLevel(x) m_debug.setLevel( x ) 145 #define debugError(format, args...) m_debug.error( __FILE__, __FUNCTION__, __LINE__, format, ##args ) 146 #define debugPrint(level, format, args...) m_debug.print( level, __FILE__, __FUNCTION__, __LINE__, format, ##args ) 147 #define debugPrintShort(level, format, args...) m_debug.printShort( level, format, ##args ) 148 149 #define setGlobalDebugLevel(x) gGlobalDebugModule.setLevel( x ) 150 #define debugGlobalError(format, args...) gGlobalDebugModule.error( __FILE__, __FUNCTION__, __LINE__, format, ##args ) 151 #define debugGlobalPrint(level, format, args...) gGlobalDebugModule.print( level, __FILE__, __FUNCTION__, __LINE__, format, ##args ) 152 #define debugGlobalPrintShort(level, format, args...) gGlobalDebugModule.printShort( level, format, ##args ) 135 153 136 154 // XXX To change the debug module the header has to be edited 137 155 // which sucks big time 138 156 #define DECLARE_DEBUG_MODULE DebugAnsiColor m_debug 157 158 // For static functions 159 #define DECLARE_GLOBAL_DEBUG_MODULE DebugAnsiColor gGlobalDebugModule 160 #define USE_GLOBAL_DEBUG_MODULE extern DebugAnsiColor gGlobalDebugModule 139 161 140 162 #else /* !DEBUG */