fuse_log.c (754B)
1 /* 2 * FUSE: Filesystem in Userspace 3 * Copyright (C) 2019 Red Hat, Inc. 4 * 5 * Logging API. 6 * 7 * This program can be distributed under the terms of the GNU LGPLv2. 8 * See the file COPYING.LIB 9 */ 10 11 #include "qemu/osdep.h" 12 #include "fuse_log.h" 13 14 15 static void default_log_func(__attribute__((unused)) enum fuse_log_level level, 16 const char *fmt, va_list ap) 17 { 18 vfprintf(stderr, fmt, ap); 19 } 20 21 static fuse_log_func_t log_func = default_log_func; 22 23 void fuse_set_log_func(fuse_log_func_t func) 24 { 25 if (!func) { 26 func = default_log_func; 27 } 28 29 log_func = func; 30 } 31 32 void fuse_log(enum fuse_log_level level, const char *fmt, ...) 33 { 34 va_list ap; 35 36 va_start(ap, fmt); 37 log_func(level, fmt, ap); 38 va_end(ap); 39 }