summaryrefslogtreecommitdiff
path: root/lib/log.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2016-02-23 11:59:36 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-03-08 00:15:39 +0100
commitbb85d700d564ef836af88c9d17190c2c39b93e21 (patch)
treeab62aa870ed3661104142ffa8556e40479ce4b46 /lib/log.c
parent4525281af19b5800ffce4bda83e0957d21ccad43 (diff)
lib: ditch struct zlog * argument on zlog/vzlog()
It's completely useless... Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c27
1 files changed, 12 insertions, 15 deletions
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);