0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-21 09:11:54 +00:00

Logging: exposing vlog() to log va_lists

This commit is contained in:
Maria Matejka 2024-11-14 21:20:49 +01:00 committed by Ondrej Zajicek
parent 145830bdc8
commit 4dd5b3d90e
3 changed files with 6 additions and 4 deletions

View File

@ -17,7 +17,7 @@
/* Client versions of logging functions */
static void
vlog(const char *msg, va_list args)
vlog_cli(const char *msg, va_list args)
{
char buf[1024];
@ -38,7 +38,7 @@ bug(const char *msg, ...)
va_start(args, msg);
cleanup();
fputs("Internal error: ", stderr);
vlog(msg, args);
vlog_cli(msg, args);
vfprintf(stderr, msg, args);
va_end(args);
exit(1);
@ -51,7 +51,7 @@ die(const char *msg, ...)
va_start(args, msg);
cleanup();
vlog(msg, args);
vlog_cli(msg, args);
va_end(args);
exit(1);
}

View File

@ -10,6 +10,7 @@
#define _BIRD_BIRDLIB_H_
#include "lib/alloca.h"
#include <stdarg.h>
/* Ugly structure offset handling macros */
@ -159,6 +160,7 @@ void log_msg(const char *msg, ...);
void log_rl(struct tbf *rl, const char *msg, ...);
void die(const char *msg, ...) NORET;
void bug(const char *msg, ...) NORET;
void vlog(int class, const char *msg, va_list args);
#define L_DEBUG "\001" /* Debugging messages */
#define L_TRACE "\002" /* Protocol tracing */

View File

@ -274,7 +274,7 @@ log_commit(int class, buffer *buf)
int buffer_vprint(buffer *buf, const char *fmt, va_list args);
static void
void
vlog(int class, const char *msg, va_list args)
{
buffer buf;