From 317181e8ea1b3406919b946ca5524f8b9f34817d Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 4 Sep 2019 15:59:18 +0100 Subject: Introduce callback for logging Introduce an API for custom log handler functions. This allows libfuse applications to send messages to syslog(3) or other logging systems. See include/fuse_log.h for details. Convert libfuse from fprintf(stderr, ...) to log_fuse(level, ...). Most messages are error messages with FUSE_LOG_ERR log level. There are also some debug messages which now use the FUSE_LOG_DEBUG log level. Note that lib/mount_util.c is used by both libfuse and fusermount3. Since fusermount3 does not link against libfuse, we cannot call fuse_log() from lib/mount_util.c. This file will continue to use fprintf(stderr, ...) until someone figures out how to split it up. Signed-off-by: Stefan Hajnoczi --- lib/fuse_i.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/fuse_i.h') diff --git a/lib/fuse_i.h b/lib/fuse_i.h index d38b630..4883ef6 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -131,6 +131,8 @@ struct fuse *fuse_new_31(struct fuse_args *args, const struct fuse_operations *o int fuse_loop_mt_32(struct fuse *f, struct fuse_loop_config *config); int fuse_session_loop_mt_32(struct fuse_session *se, struct fuse_loop_config *config); +void fuse_log(enum fuse_log_level level, const char *fmt, ...); + #define FUSE_MAX_MAX_PAGES 256 #define FUSE_DEFAULT_MAX_PAGES_PER_REQ 32 -- cgit v1.2.3