IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 9, 2004, 11:59:03 AM (22 years ago)
Author:
desonia
Message:

changed the format of the log message, per bugzilla report #189.

File:
1 edited

Legend:

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

    r1731 r1761  
    1212 *  @author George Gusciora, MHPCC
    1313 *
    14  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-09-08 21:22:47 $
     14 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-09-09 21:59:03 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    302302        psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, fmt);
    303303        level = (level < 0) ? 0 : 9;
     304        clevel = level + '0';
    304305        break;
    305306    }
     
    327328        head_ptr += strlen(head_ptr);
    328329    }
    329     // The name field must be 15 characters.
    330330    if (logName) {
    331331        if (head_ptr > head) {
    332332            *head_ptr++ = '|';
    333333        }
    334         if (strlen(name) > 15) {
    335             maxLength -= snprintf(head_ptr, maxLength, "+%14.14s", &name[strlen(name)-14]);
    336         } else {
    337             maxLength -= snprintf(head_ptr, maxLength, "%15.15s", name);
    338         }
     334        maxLength -= snprintf(head_ptr, maxLength, "%s", name);
    339335
    340336        head_ptr += strlen(head_ptr);
     
    342338
    343339    if (head_ptr > head) {
    344         *head_ptr++ = '|';
     340        *head_ptr++ = '\n';
    345341    } else if (!logMsg) {                  // no output desired
    346342        return;
     
    350346    fputs(head, logDest);
    351347    if (logMsg) {
    352         vfprintf(logDest, fmt, ap);
    353         if (fmt[strlen(fmt) - 1] != '\n') {
    354             fputc('\n', logDest);
     348        char msg[1024];
     349        char* msgPtr;
     350        vsnprintf(msg,1024, fmt, ap);  // create message
     351
     352        // detect multiple lines in message and indent each line by 4 spaces.
     353        char* line = strtok_r(msg,"\n",&msgPtr);
     354        while (line != NULL) {
     355            fprintf(logDest,"    %s\n",line);
     356            line = strtok_r(NULL,"\n",&msgPtr);
    355357        }
    356358    } else {
Note: See TracChangeset for help on using the changeset viewer.