Changeset 1761 for trunk/psLib/src/sys/psLogMsg.c
- Timestamp:
- Sep 9, 2004, 11:59:03 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psLogMsg.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psLogMsg.c
r1731 r1761 12 12 * @author George Gusciora, MHPCC 13 13 * 14 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $15 * @date $Date: 2004-09-0 8 21:22:47$14 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2004-09-09 21:59:03 $ 16 16 * 17 17 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 302 302 psTrace("utils.logMsg", 2, "Invalid logMsg level: %d (%s)\n", level, fmt); 303 303 level = (level < 0) ? 0 : 9; 304 clevel = level + '0'; 304 305 break; 305 306 } … … 327 328 head_ptr += strlen(head_ptr); 328 329 } 329 // The name field must be 15 characters.330 330 if (logName) { 331 331 if (head_ptr > head) { 332 332 *head_ptr++ = '|'; 333 333 } 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); 339 335 340 336 head_ptr += strlen(head_ptr); … … 342 338 343 339 if (head_ptr > head) { 344 *head_ptr++ = ' |';340 *head_ptr++ = '\n'; 345 341 } else if (!logMsg) { // no output desired 346 342 return; … … 350 346 fputs(head, logDest); 351 347 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); 355 357 } 356 358 } else {
Note:
See TracChangeset
for help on using the changeset viewer.
