aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_log.c
AgeCommit message (Collapse)AuthorLines
2025-02-20fuse_log: simplify default log functionVassili Tchersky-42/+5
fuse_log_level is guaranteed to be the same as libc as syslog is a network protocol and levels are numerical constants enforced in RFCs. Syslog is originally BSD-only and was imported by glibc and standardised in SUS and POSIX. Use vsyslog rather than formatting a new intermediate string. Signed-off-by: Vassili Tchersky <vt+git@vbc.su>
2024-07-17fuse_log: initialize sys_log_level variable to avoid compiler warningJoanne Koong-2/+2
2024-07-14Add syslog and fatal signal handler featureBernd Schubert-4/+60
I see random ENOTCONN failures in xfstest generic/013 and generic/014 in my branch, but earliest on the 2nd run - takes ~12hours to get the issue, but then there are no further information logged. ENOTCONN points to a daemon crash - I need backtraces and a core dump. This adds optional handling of fatal signals to print a core dump and optional syslog logging with these new public functions: fuse_set_fail_signal_handlers() In addition to the existing fuse_set_signal_handlers(). This is not enabled together with fuse_set_signal_handlers(), as it is change in behavior and file systems might already have their own fatal handlers. fuse_log_enable_syslog Print logs to syslog instead of stderr fuse_log_close_syslog Close syslog (for now just does closelog()) Code in fuse_signals.c is also updated, to be an array of signals, and setting signal handlers is now down with a for-loop instead of one hand coded set_one_signal_handler() per signal.
2019-09-10log: move fuse_log() to the public header fileStefan Hajnoczi-1/+0
Applications may wish to call fuse_log() for unified logging. This way they don't need to define their own wrappers to invoke the log message handler function installed by fuse_set_log_func(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-09-04Introduce callback for loggingStefan Hajnoczi-0/+41
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 <stefanha@redhat.com>