Changeset 9540 for trunk/psLib/src/sys/psTrace.c
- Timestamp:
- Oct 13, 2006, 12:04:58 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psTrace.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psTrace.c
r8601 r9540 9 9 * @author GLG, MHPCC 10 10 * 11 * @version $Revision: 1.7 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2006- 08-25 22:01:29$11 * @version $Revision: 1.79 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-10-13 22:04:58 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 69 69 static void componentFree(p_psComponent* comp); 70 70 static p_psComponent* componentAlloc(const char *name, int level); 71 static int getLevel(const char *facil); 71 72 72 73 /***************************************************************************** … … 122 123 } 123 124 } 125 126 // Append the function name to the facility 127 // NB: declares TARGET! 128 #define FACILITY(TARGET, FUNC, FACIL) \ 129 size_t _facilLength = strlen(FACIL); /* Length of facility name */ \ 130 size_t _funcLength = strlen(FUNC); /* Length of function name */ \ 131 char TARGET[_facilLength + _funcLength + 2]; /* facility + the function name */ \ 132 strcpy(&TARGET[0], FACIL); \ 133 TARGET[_facilLength] = '.'; \ 134 strcpy(&TARGET[_facilLength + 1], FUNC); 135 124 136 125 137 /***************************************************************************** … … 283 295 compName = (char *) comp; 284 296 } 285 prevLevel = psTraceGetLevel(compName);297 prevLevel = getLevel(compName); 286 298 // Add the new component to the component tree. 287 299 if ( !componentAdd(compName, level) ) { … … 385 397 } 386 398 387 /***************************************************************************** 388 psTraceLevelGet() 399 400 /***************************************************************************** 401 getLevel() 389 402 Return a trace level of "name" in the root component tree. If the 390 403 exact string of components in "name" does not exist in the root 391 404 tree, we return the deepest level of the match. 392 Input: 393 name 394 Output: 395 none 396 Return: 397 The level of "name" in the root component tree. 398 *****************************************************************************/ 399 int psTraceGetLevel(const char *name) 400 { 401 PS_ASSERT_PTR_NON_NULL(name, 0); 402 403 psS32 traceLevel; 404 405 *****************************************************************************/ 406 static int getLevel(const char *name) 407 { 405 408 if (cRoot == NULL) { 406 409 return (PS_UNKNOWN_TRACE_LEVEL); 407 410 } 411 412 psS32 traceLevel; 408 413 409 414 // If the component name has no leading dot, then supply it. … … 430 435 431 436 return(traceLevel); 437 } 438 439 int p_psTraceGetLevel(const char *file, 440 int lineno, 441 const char *func, 442 const char *name) 443 { 444 PS_ASSERT_PTR_NON_NULL(name, 0); 445 PS_ASSERT_PTR_NON_NULL(func, 0); 446 447 FACILITY(facility, func, name); 448 return getLevel(facility); 432 449 } 433 450 … … 520 537 // Only display this message if it's trace level is less than the level 521 538 // of it's associatedcomponent. 522 if (level <= psTraceGetLevel(comp)) {539 if (level <= getLevel(comp)) { 523 540 524 541 char clevel = 0; // letter-name for level … … 641 658 PS_ASSERT_PTR_NON_NULL(format, ); 642 659 643 // XXX file & lineo are currently unused 644 645 // Append the function name to the facility 646 size_t facilLength = strlen(facil); // Length of facility name 647 size_t funcLength = strlen(func); // Length of function name 648 char fullFacil[facilLength + funcLength + 2]; // Full facility name is the facility + the function name 649 strcpy(&fullFacil[0], facil); 650 fullFacil[facilLength] = '.'; 651 strcpy(&fullFacil[facilLength + 1], func); 660 FACILITY(name, func, facil); 652 661 653 662 va_list ap; 654 663 va_start(ap, format); 655 psTraceV( fullFacil, level, format, ap);664 psTraceV(name, level, format, ap); 656 665 va_end(ap); 657 666 }
Note:
See TracChangeset
for help on using the changeset viewer.
