d8f6adcd23385fd99907a319f05449efca679c80 galt Wed Jul 6 10:17:01 2011 -0700 fix errAbortInProgress diff --git src/lib/log.c src/lib/log.c index 12fb4ab..45b7035 100644 --- src/lib/log.c +++ src/lib/log.c @@ -103,34 +103,34 @@ static char *nameValTblMsg(struct nameVal *tbl) /* generate a message for values in table */ { struct dyString *msg = dyStringNew(256); int i; for (i = 0; tbl[i].name != NULL; i++) { if (i > 0) dyStringAppend(msg, ", "); dyStringAppend(msg, tbl[i].name); } return dyStringCannibalize(&msg); } -static void logWarnHander(char *format, va_list args) +static void logWarnHandler(char *format, va_list args) /* Warn handler that logs message. */ { -if (errAbortInProgress) +if (isErrAbortInProgress()) logErrorVa(format, args); else logWarnVa(format, args); } static void logAbortHandler() /* abort handler that logs this fact and exits. */ { logError("%s aborted", gProgram); fprintf(stderr, "aborted"); exit(1); } static void setProgram(char* program) /* set the program name, removing leading directories from file */ @@ -167,47 +167,47 @@ if (val < 0) errAbort("invalid log priority: %s, expected one of: %s", pri, nameValTblMsg(priorityNameTbl)); return val; } void logOpenSyslog(char* program, char *facility) /* Initialize syslog using the specified facility. Facility is the syslog * facility as specified in syslog.conf. If facility is NULL, local0 is used. * This adds a warn and errAbort handlers that do logging. If custom handlers * are added, they should call logErrorVa(). */ { #ifndef NO_SYSLOG setProgram(program); openlog(program, LOG_PID, parseFacility(facility)); -pushWarnHandler(logWarnHander); +pushWarnHandler(logWarnHandler); pushAbortHandler(logAbortHandler); gSysLogOn = TRUE; #else errAbort("syslog support was not compiled into %s", __FILE__); #endif } void logOpenFile(char* program, char *logFile) /* Initialize logging to the specified file. Append to the file if it exists. * This adds a warn and errAbort handlers that do logging. If custom handlers * are added, they should call logErrorVa(). */ { setProgram(program); gLogFh = mustOpen(logFile, "a"); -pushWarnHandler(logWarnHander); +pushWarnHandler(logWarnHandler); pushAbortHandler(logAbortHandler); } void logSetMinPriority(char *minPriority) /* set minimum priority to log, which is one of the syslog priority names, * even when logging to a file */ { gMinPriority = parsePriority(minPriority); } FILE *logGetFile() /* Returns the log FILE object if file logging is enabled, or NULL if it * isn't. This is useful for logging debugging data that doesn't fit the log * message paradigm, For example, logging fasta records. */ {