diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 1f3066b5c5..8095999163 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -352,7 +352,7 @@ rfapiDebugPrintf (void *dummy, const char *format, ...) { va_list args; va_start (args, format); - vzlog (NULL, LOG_DEBUG, format, args); + vzlog (LOG_DEBUG, format, args); va_end (args); return 0; } diff --git a/ldpd/log.c b/ldpd/log.c index b30604db0d..3bad86499d 100644 --- a/ldpd/log.c +++ b/ldpd/log.c @@ -59,7 +59,7 @@ vlog(int pri, const char *fmt, va_list ap) ldpe_imsg_compose_parent(IMSG_LOG, pri, buf, strlen(buf) + 1); break; case PROC_MAIN: - vzlog(NULL, pri, fmt, ap); + vzlog(pri, fmt, ap); break; } } diff --git a/lib/command.c b/lib/command.c index d87381f1ef..10d36370d1 100644 --- a/lib/command.c +++ b/lib/command.c @@ -2163,7 +2163,7 @@ DEFUN (config_logmsg, if ((level = level_match(argv[idx_log_level]->arg)) == ZLOG_DISABLED) return CMD_ERR_NO_MATCH; - zlog(NULL, level, "%s", ((message = argv_concat(argv, argc, idx_message)) ? message : "")); + zlog(level, "%s", ((message = argv_concat(argv, argc, idx_message)) ? message : "")); if (message) XFREE(MTYPE_TMP, message); diff --git a/lib/log.c b/lib/log.c index 5821965478..60eeede7bf 100644 --- a/lib/log.c +++ b/lib/log.c @@ -185,16 +185,13 @@ time_print(FILE *fp, struct timestamp_control *ctl) /* va_list version of zlog. */ void -vzlog (struct zlog *zl, int priority, const char *format, va_list args) +vzlog (int priority, const char *format, va_list args) { char proto_str[32]; int original_errno = errno; struct timestamp_control tsctl; tsctl.already_rendered = 0; - - /* If zlog is not specified, use default one. */ - if (zl == NULL) - zl = zlog_default; + struct zlog *zl = zlog_default; /* When zlog_default is also NULL, use stderr for logging. */ if (zl == NULL) @@ -639,7 +636,7 @@ void zlog_backtrace(int priority) { #ifndef HAVE_GLIBC_BACKTRACE - zlog(NULL, priority, "No backtrace available on this platform."); + zlog(priority, "No backtrace available on this platform."); #else void *array[20]; int size, i; @@ -653,29 +650,29 @@ zlog_backtrace(int priority) size, (unsigned long)(array_size(array))); return; } - zlog(NULL, priority, "Backtrace for %d stack frames:", size); + zlog(priority, "Backtrace for %d stack frames:", size); if (!(strings = backtrace_symbols(array, size))) { zlog_err("Cannot get backtrace symbols (out of memory?)"); for (i = 0; i < size; i++) - zlog(NULL, priority, "[bt %d] %p",i,array[i]); + zlog(priority, "[bt %d] %p",i,array[i]); } else { for (i = 0; i < size; i++) - zlog(NULL, priority, "[bt %d] %s",i,strings[i]); + zlog(priority, "[bt %d] %s",i,strings[i]); free(strings); } #endif /* HAVE_GLIBC_BACKTRACE */ } void -zlog (struct zlog *zl, int priority, const char *format, ...) +zlog (int priority, const char *format, ...) { va_list args; va_start(args, format); - vzlog (zl, priority, format, args); + vzlog (priority, format, args); va_end (args); } @@ -685,7 +682,7 @@ FUNCNAME(const char *format, ...) \ { \ va_list args; \ va_start(args, format); \ - vzlog (NULL, PRIORITY, format, args); \ + vzlog (PRIORITY, format, args); \ va_end(args); \ } @@ -704,11 +701,11 @@ ZLOG_FUNC(zlog_debug, LOG_DEBUG) void zlog_thread_info (int log_level) { if (thread_current) - zlog(NULL, log_level, "Current thread function %s, scheduled from " + zlog(log_level, "Current thread function %s, scheduled from " "file %s, line %u", thread_current->funcname, thread_current->schedfrom, thread_current->schedfrom_line); else - zlog(NULL, log_level, "Current thread not known/applicable"); + zlog(log_level, "Current thread not known/applicable"); } void @@ -720,7 +717,7 @@ _zlog_assert_failed (const char *assertion, const char *file, ((logfile_fd = open_crashlog()) >= 0) && ((zlog_default->fp = fdopen(logfile_fd, "w")) != NULL)) zlog_default->maxlvl[ZLOG_DEST_FILE] = LOG_ERR; - zlog(NULL, LOG_CRIT, "Assertion `%s' failed in file %s, line %u, function %s", + zlog(LOG_CRIT, "Assertion `%s' failed in file %s, line %u, function %s", assertion,file,line,(function ? function : "?")); zlog_backtrace(LOG_CRIT); zlog_thread_info(LOG_CRIT); diff --git a/lib/log.h b/lib/log.h index 00c996c5be..d0f8c0c3ac 100644 --- a/lib/log.h +++ b/lib/log.h @@ -119,19 +119,17 @@ extern void closezlog (struct zlog *zl); #endif /* __GNUC__ */ /* Generic function for zlog. */ -extern void zlog (struct zlog *zl, int priority, const char *format, ...) - PRINTF_ATTRIBUTE(3, 4); +extern void zlog (int priority, const char *format, ...) + PRINTF_ATTRIBUTE(2, 3); /* Handy zlog functions. */ -extern void vzlog (struct zlog *zl, int priority, const char *format, va_list args); +extern void vzlog (int priority, const char *format, va_list args); extern void zlog_err (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_warn (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_info (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_notice (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); extern void zlog_debug (const char *format, ...) PRINTF_ATTRIBUTE(1, 2); -extern void vzlog (struct zlog *, int , const char *, va_list ); - extern void zlog_thread_info (int log_level); /* Set logging level for the given destination. If the log_level diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 56a5f8e582..2dba64c5bd 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -111,7 +111,7 @@ _rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn, int prior snprintf(buf, sizeof(buf), "{(route_node *) NULL}"); } - zlog (NULL, priority, "%s: %d:%s: %s", _func, vrf_id, buf, msgbuf); + zlog (priority, "%s: %d:%s: %s", _func, vrf_id, buf, msgbuf); } #define rnode_debug(node, vrf_id, ...) \