IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 8, 2004, 11:22:47 AM (22 years ago)
Author:
desonia
Message:

changed the naming conventions of errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psTrace.c

    r1718 r1731  
    99 *  @author George Gusciora, MHPCC
    1010 *
    11  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-09-08 05:59:41 $
     11 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2004-09-08 21:22:47 $
    1313 *
    1414 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4848#include "psString.h"
    4949#include "psError.h"
    50 #include "psAbort.h"
     50#include "psLogMsg.h"
     51
     52#include "psSysUtilsErrors.h"
    5153
    5254static p_psComponent* cRoot = NULL; // The root of the trace component
     
    117119    for (i = 0; i < currentNode->n; i++) {
    118120        if (NULL == currentNode->subcomp[i]) {
    119             psError(__func__,
    120                     "Sub-component %d of node %s in the trace tree is NULL.\n", i, currentNode->name);
     121            psLogMsg(PS_ERRORNAME_DOMAIN "p_psTraceReset", PS_LOG_WARN,
     122                     PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     123                     i, currentNode->name);
    121124        } else {
    122125            p_psTraceReset(currentNode->subcomp[i]);
     
    141144to ANSI-C.
    142145 *****************************************************************************/
    143 static void componentAdd(const char *addNodeName, int level)
     146static bool componentAdd(const char *addNodeName, int level)
    144147{
    145148    int i = 0;                  // Loop index variable.
     
    152155    // XXX: Verify that this is the correct behavior.
    153156    if (strcmp("", addNodeName) == 0) {
    154         psAbort(__func__, "Failed to add null component to trace tree.\n");
     157        psErrorMsg(PS_ERRORNAME_DOMAIN "componentAdd",PS_ERR_BAD_PARAMETER_NULL,true,
     158                   PS_ERRORTEXT_psTrace_ADD_NULL_COMPONENT);
     159        return false;
    155160    }
    156161
     
    158163    if (strcmp(".", addNodeName) == 0) {
    159164        cRoot->level = level;
    160         return;
     165        return true;
    161166    }
    162167
    163168    if (addNodeName[0] != '.') {
    164         printf("ERROR: failed to add %s to the root component tree.\n", addNodeName);
    165         exit(1);
     169        psErrorMsg(PS_ERRORNAME_DOMAIN "componentAdd",PS_ERR_BAD_PARAMETER_VALUE,true,
     170                   PS_ERRORTEXT_psTrace_MALFORMED_COMPONENT_NAME,
     171                   addNodeName);
     172        return false;
    166173    }
    167174
     
    205212        }
    206213    }
     214
     215    return true;
    207216}
    208217
     
    218227 zero
    219228*****************************************************************************/
    220 int psTraceSetLevel(const char *comp,   // component of interest
    221                     int level)  // desired trace level
     229bool psTraceSetLevel(const char *comp,   // component of interest
     230                     int level)  // desired trace level
    222231{
    223232    // If the root component tree does not exist, then initialize it.
     
    226235    }
    227236    // Add the new component to the component tree.
    228     componentAdd(comp, level);
    229 
    230     // return 0 on success.
    231     return 0;
     237    if ( !componentAdd(comp, level) ) {
     238        psErrorMsg(PS_ERRORNAME_DOMAIN "psTraceSetLevel", PS_ERR_UNKNOWN, false,
     239                   PS_ERRORTEXT_psTrace_FAILED_TO_ADD_COMPONENT,level,comp);
     240        return false;
     241    }
     242    return true;
    232243}
    233244
     
    274285        for (i = 0; i < currentNode->n; i++) {
    275286            if (NULL == currentNode->subcomp[i]) {
    276                 psError(__func__,
    277                         "Sub-component %d of node %s in trace tree is NULL.\n", i, currentNode->name);
     287                psLogMsg(PS_ERRORNAME_DOMAIN "p_psTraceReset", PS_LOG_WARN,
     288                         PS_ERRORTEXT_psTrace_NULL_SUBCOMPONENT,
     289                         i, currentNode->name);
    278290            }
    279291
     
    321333
    322334/*****************************************************************************
    323     doPrintTraceLevelsOld()
    324  This function recursively searches the component tree supplied by the
    325  parameter "comp" and prints the name and level of each component.
    326     Inputs:
    327  comp: a node in the component tree.
    328  level: the level of that node
    329     Outputs:
    330  none
    331     Returns:
    332  null
    333  *****************************************************************************/
    334 static void doPrintTraceLevelsOld(const p_psComponent* comp, int depth)
    335 {
    336     int i = 0;
    337 
    338     if (comp->name[0] == '\0') {
    339         printf("%*s%-*s %d\n", depth, "", 20 - depth,
    340                "(root)", (comp->level == PS_DEFAULT_TRACE_LEVEL) ? 0 : comp->level);
    341     } else {
    342         if (comp->level == PS_DEFAULT_TRACE_LEVEL) {
    343             printf("%*s%-*s %s\n", depth, "", 20 - depth, comp->name, ".");
    344         } else {
    345             printf("%*s%-*s %d\n", depth, "", 20 - depth, comp->name,
    346                    comp->level);
    347         }
    348     }
    349 
    350     for (i = 0; i < comp->n; i++) {
    351         doPrintTraceLevelsOld(comp->subcomp[i], depth + 1);
    352     }
    353 }
    354 
    355 /*****************************************************************************
    356335    doPrintTraceLevels()
    357336 This function recursively searches the component tree supplied by the
     
    372351
    373352    if (comp->name[0] == '\0') {
    374         psAbort(__func__, "component name is NULL\n");
     353        return;
    375354    } else {
    376355        if (comp->level == PS_DEFAULT_TRACE_LEVEL) {
     
    435414
    436415    if (NULL == comp) {
    437         psError(__func__, "p_psTrace() called on a NULL trace level tree\n");
     416        psErrorMsg(PS_ERRORNAME_DOMAIN "psTrace", PS_ERR_BAD_PARAMETER_NULL, true,
     417                   PS_ERRORTEXT_psTrace_NULL_TRACETREE,
     418                   __func__);
     419        return;
    438420    }
    439421    // Only display this message if it's trace level is less than the level
Note: See TracChangeset for help on using the changeset viewer.