IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 4, 2004, 3:27:54 PM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r560 r885  
    3939
    4040static Component *croot = NULL;           // The root of the trace component
     41static FILE *traceFP = NULL;
    4142/*****************************************************************************
    4243    componentAlloc(): allocate memory for a new node, and initialize members.
     
    378379        va_start(ap, level);
    379380
    380         // We indent each message one space foe each level of the message.
    381         for (i = 0; i < level; i++) {
    382             putchar(' ');
    383         }
    384 
    385381        // The following functions get the variable list of parameters with
    386382        // which this function was called, and print them to the standard
    387383        // output.
    388384        fmt = va_arg(ap, char *);
    389         vprintf(fmt, ap);
     385
     386        if (traceFP != NULL) {
     387            // We indent each message one space for each level of the message.
     388            for (i = 0; i < level; i++) {
     389                fprintf(traceFP, " ");
     390            }
     391            vfprintf(traceFP, fmt, ap);
     392        } else {
     393            // We indent each message one space for each level of the message.
     394            for (i = 0; i < level; i++) {
     395                putchar(' ');
     396            }
     397            vprintf(fmt, ap);
     398        }
    390399        va_end(ap);
    391400    }
     
    393402    // NOTE: should we free *fmt as well?  Read the man page.
    394403}
     404
     405void psTraceSetDestination(FILE *fp)
     406{
     407    traceFP = fp;
     408}
Note: See TracChangeset for help on using the changeset viewer.