Changeset 1713 for trunk/psLib/src/sysUtils/psTrace.c
- Timestamp:
- Sep 7, 2004, 2:09:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sysUtils/psTrace.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sysUtils/psTrace.c
r1700 r1713 9 9 * @author George Gusciora, MHPCC 10 10 * 11 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-09-0 7 19:58:06 $11 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-09-08 00:09:06 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 #include "psString.h" 41 41 #include "psError.h" 42 #include "psAbort.h" 42 #include "psLogMsg.h" 43 44 #include "psSysUtilsErrors.h" 45 #define ERRORNAME_PREFIX PS_ERRORNAME_DOMAIN ".psTrace." 43 46 44 47 static p_psComponent* cRoot = NULL; // The root of the trace component … … 107 110 for (i = 0; i < currentNode->n; i++) { 108 111 if (NULL == currentNode->subcomp[i]) { 109 psError(__func__, 110 "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name); 112 psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN, 113 PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT, 114 i, currentNode->name); 111 115 } else { 112 116 p_psTraceReset(currentNode->subcomp[i]); … … 131 135 to ANSI-C. 132 136 *****************************************************************************/ 133 static voidcomponentAdd(const char *addNodeName, int level)137 static bool componentAdd(const char *addNodeName, int level) 134 138 { 135 139 int i = 0; // Loop index variable. … … 142 146 // XXX: Verify that this is the correct behavior. 143 147 if (strcmp("", addNodeName) == 0) { 144 psAbort(__func__, "Failed to add null component to trace tree.\n"); 148 psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true, 149 PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT); 150 return false; 145 151 } 146 152 … … 148 154 if (strcmp(".", addNodeName) == 0) { 149 155 cRoot->level = level; 150 return ;156 return true; 151 157 } 152 158 153 159 if (addNodeName[0] != '.') { 154 psAbort(__func__,"Failed to add %s to the root component tree.\n", 155 addNodeName); 160 psErrorMsg(ERRORNAME_PREFIX "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true, 161 PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME, 162 addNodeName); 163 return false; 156 164 } 157 165 … … 188 196 } 189 197 } 198 199 return true; 190 200 } 191 201 … … 201 211 zero 202 212 *****************************************************************************/ 203 intpsTraceSetLevel(const char *comp, // component of interest204 int level) // desired trace level213 bool psTraceSetLevel(const char *comp, // component of interest 214 int level) // desired trace level 205 215 { 206 216 // If the root component tree does not exist, then initialize it. … … 209 219 } 210 220 // Add the new component to the component tree. 211 componentAdd(comp, level); 212 221 if ( !componentAdd(comp, level) ) { 222 psErrorMsg(ERRORNAME_PREFIX "psTraceSetLevel", PS_ERR_UNKNOWN, false, 223 PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp); 224 return false; 225 } 213 226 // return 0 on success. 214 return 0;227 return true; 215 228 } 216 229 … … 255 268 for (i = 0; i < currentNode->n; i++) { 256 269 if (NULL == currentNode->subcomp[i]) { 257 psError(__func__, 258 "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name); 270 psLogMsg(ERRORNAME_PREFIX "p_psTraceReset", PS_LOG_WARN, 271 PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT, 272 i, currentNode->name); 259 273 } 260 274 … … 365 379 366 380 if (NULL == comp) { 367 psError(__func__, "p_psTrace() called on a NULL trace level tree\n"); 381 psErrorMsg(ERRORNAME_PREFIX "psTrace", PS_ERR_BAD_PARAMETER_NULL, true, 382 PS_ERRORTEXT_psTrace_NULL_TRACETREE, 383 __func__); 384 return; 368 385 } 369 386 // Only display this message if it's trace level is less than the level
Note:
See TracChangeset
for help on using the changeset viewer.
