1
0
Fork 0
mirror of https://passt.top/passt synced 2025-06-08 00:35:33 +02:00

log: Add vlogmsg()

Currently logmsg() is only available as a variadic function.  This is fine
for normal use, but is awkward if we ever want to write wrappers around it
which (for example) add standardised prefix information.  To allow that,
add a vlogmsg() function which takes a va_list instead, and implement
logmsg() in terms of it.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
David Gibson 2023-10-13 15:50:30 +11:00 committed by Stefano Brivio
parent 5972203174
commit c0426ff10b
2 changed files with 17 additions and 9 deletions

1
log.h
View file

@ -12,6 +12,7 @@
#define LOGFILE_CUT_RATIO 30 /* When full, cut ~30% size */
#define LOGFILE_SIZE_MIN (5UL * MAX(BUFSIZ, PAGE_SIZE))
void vlogmsg(int pri, const char *format, va_list ap);
void logmsg(int pri, const char *format, ...)
__attribute__((format(printf, 2, 3)));