qemu-e2k/tools/virtiofsd/fuse_log.c
Daniel P. Berrangé e4418354c0 tools/virtiofsd: add G_GNUC_PRINTF for logging functions
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20221219130205.687815-4-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2023-01-11 10:44:34 +01:00

41 lines
774 B
C

/*
* FUSE: Filesystem in Userspace
* Copyright (C) 2019 Red Hat, Inc.
*
* Logging API.
*
* This program can be distributed under the terms of the GNU LGPLv2.
* See the file COPYING.LIB
*/
#include "qemu/osdep.h"
#include "fuse_log.h"
G_GNUC_PRINTF(2, 0)
static void default_log_func(__attribute__((unused)) enum fuse_log_level level,
const char *fmt, va_list ap)
{
vfprintf(stderr, fmt, ap);
}
static fuse_log_func_t log_func = default_log_func;
void fuse_set_log_func(fuse_log_func_t func)
{
if (!func) {
func = default_log_func;
}
log_func = func;
}
void fuse_log(enum fuse_log_level level, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
log_func(level, fmt, ap);
va_end(ap);
}