#include <CSLog.h>
Public Member Functions | |
void | print (int level, const std::string &text) |
void | print (int level, const std::string &text, int value) |
void | print (int level, const std::string &text, long value) |
void | print (int level, const std::string &text, float value) |
void | startFunction (const std::string &methodName, const std::string &className) |
void | endFunction () |
void | setDebugType (int type) |
int | getDebugType () |
void | setDebugLevel (int level) |
int | getDebugLevel () |
void | addCallback (CSLogCallback *callback) |
void | removeCallback (CSLogCallback *callback) |
void | setFunctionTracking (bool b) |
Debug Level. | |
void | setShortMessage (bool b) |
void | setOnlyTrackClass (const std::string &className) |
void | setOnlyTrackMethod (const std::string &methodName) |
Static Public Member Functions | |
CSLog * | getInstance (const std::string &identifier) |
void | deleteInstance (const std::string &identifier) |
|
Definition at line 192 of file CSLog.cpp.
00193 { 00194 CSLog *instance = 0; 00195 try 00196 { 00197 LogMap::iterator iter = mMap.find(identifier); 00198 if (iter != mMap.end()) 00199 { 00200 instance = iter->second; 00201 } 00202 else 00203 { 00204 instance = new CSLog(identifier); 00205 mMap.insert(LogMap::value_type(identifier, instance)); 00206 } 00207 } 00208 catch (...) 00209 { 00210 } 00211 return instance; 00212 } |
|
Definition at line 214 of file CSLog.cpp.
00215 { 00216 CSLog *instance = 0; 00217 LogMap::iterator iter = mMap.find(identifier); 00218 if (iter != mMap.end()) 00219 { 00220 instance = iter->second; 00221 delete(instance); 00222 mMap.erase(iter); 00223 } 00224 } |
|
Definition at line 226 of file CSLog.cpp. Referenced by print().
00227 { 00228 printInternal(level, text); 00229 } |
|
Definition at line 240 of file CSLog.cpp. References print().
00241 { 00242 std::string newText; 00243 static char valueText[80]; 00244 sprintf(valueText, "%i", value); 00245 newText = text + valueText; 00246 print(level, newText); 00247 } |
Here is the call graph for this function:
|
Definition at line 231 of file CSLog.cpp. References print().
00232 { 00233 std::string newText; 00234 static char valueText[80]; 00235 sprintf(valueText, "%i", value); 00236 newText = text + valueText; 00237 print(level, newText); 00238 } |
Here is the call graph for this function:
|
Definition at line 249 of file CSLog.cpp. References print().
00250 { 00251 std::string newText; 00252 static char valueText[80]; 00253 sprintf(valueText, "%f", value); 00254 newText = text + valueText; 00255 print(level, newText); 00256 } |
Here is the call graph for this function:
|
Definition at line 258 of file CSLog.cpp. References LOG_LEVEL_DEBUG.
00259 { 00260 mFunctionDepth++; 00261 mCurrentMethod[mFunctionDepth] = methodName; 00262 mCurrentClass[mFunctionDepth] = className; 00263 if (mFunctionTracking) 00264 { 00265 #ifdef SDL_TIMING 00266 mCurrentTime[mFunctionDepth] = SDL_GetTicks(); 00267 #endif 00268 if (!mShortMessage) 00269 { 00270 printInternal(LOG_LEVEL_DEBUG, ((std::string) "Entering...")); 00271 } 00272 } 00273 } |
|
Definition at line 275 of file CSLog.cpp. References LOG_LEVEL_DEBUG.
00276 { 00277 if (!mShortMessage) 00278 { 00279 if (mFunctionTracking) 00280 { 00281 #ifdef SDL_TIMING 00282 long timeBetween = SDL_GetTicks() - mCurrentTime[mFunctionDepth]; 00283 mCurrentTime[mFunctionDepth] = 0; 00284 std::string newText; 00285 static char valueText[80]; 00286 sprintf(valueText, "Time remaining in Method (ms): %i", timeBetween); 00287 printInternal(LOG_LEVEL_DEBUG, ((std::string) "Exiting... " + valueText)); 00288 #else 00289 printInternal(LOG_LEVEL_DEBUG, ((std::string) "Exiting...")); 00290 #endif 00291 } 00292 } 00293 mCurrentMethod[mFunctionDepth] = ""; 00294 mCurrentClass[mFunctionDepth] = ""; 00295 mFunctionDepth--; 00296 if (mFunctionDepth < 0) 00297 { 00298 mFunctionDepth = 0; 00299 } 00300 } |
|
Definition at line 302 of file CSLog.cpp.
00303 { 00304 mDebugType = type; 00305 } |
|
Definition at line 307 of file CSLog.cpp.
00308 {
00309 return mDebugType;
00310 }
|
|
Definition at line 312 of file CSLog.cpp.
00313 { 00314 mLogLevel = level; 00315 } |
|
Definition at line 317 of file CSLog.cpp.
00318 {
00319 return mLogLevel;
00320 }
|
|
Definition at line 322 of file CSLog.cpp. References removeCallback().
00323 { 00324 removeCallback(callback); 00325 mCallbacks.push_back(callback); 00326 } |
Here is the call graph for this function:
|
Definition at line 328 of file CSLog.cpp. Referenced by addCallback().
00329 { 00330 CSLogCallbacks::iterator iter = mCallbacks.begin(); 00331 while ( iter != mCallbacks.end()) 00332 { 00333 if ((*iter) == callback) 00334 { 00335 mCallbacks.erase(iter); 00336 iter = mCallbacks.begin(); // restart! 00337 } 00338 else 00339 { 00340 iter++; 00341 } 00342 } 00343 } |
|
Debug Level.
|
|
Definition at line 230 of file CSLog.h.
00230 {mShortMessage = b;} |
|
Only up to characters of name givven are compared, that means name - "r" enables to track all classes beginning with "r"! Definition at line 235 of file CSLog.h.
00235 {mTrackClassName = className;} |
|
Definition at line 236 of file CSLog.h.
00236 {mTrackMethodName = methodName;} |