]> git.proxmox.com Git - mirror_qemu.git/blame - tools/virtiofsd/fuse_log.h
target/riscv: Fix vslide1up.vf and vslide1down.vf
[mirror_qemu.git] / tools / virtiofsd / fuse_log.h
CommitLineData
ee46c789 1/*
7387863d
DDAG
2 * FUSE: Filesystem in Userspace
3 * Copyright (C) 2019 Red Hat, Inc.
4 *
5 * This program can be distributed under the terms of the GNU LGPLv2.
6 * See the file COPYING.LIB.
7 */
ee46c789
DDAG
8
9#ifndef FUSE_LOG_H_
10#define FUSE_LOG_H_
11
12/** @file
13 *
14 * This file defines the logging interface of FUSE
15 */
16
ee46c789 17
ee46c789
DDAG
18/**
19 * Log severity level
20 *
21 * These levels correspond to syslog(2) log levels since they are widely used.
22 */
23enum fuse_log_level {
7387863d
DDAG
24 FUSE_LOG_EMERG,
25 FUSE_LOG_ALERT,
26 FUSE_LOG_CRIT,
27 FUSE_LOG_ERR,
28 FUSE_LOG_WARNING,
29 FUSE_LOG_NOTICE,
30 FUSE_LOG_INFO,
31 FUSE_LOG_DEBUG
ee46c789
DDAG
32};
33
34/**
35 * Log message handler function.
36 *
37 * This function must be thread-safe. It may be called from any libfuse
38 * function, including fuse_parse_cmdline() and other functions invoked before
39 * a FUSE filesystem is created.
40 *
41 * Install a custom log message handler function using fuse_set_log_func().
42 *
43 * @param level log severity level
44 * @param fmt sprintf-style format string including newline
45 * @param ap format string arguments
46 */
7387863d 47typedef void (*fuse_log_func_t)(enum fuse_log_level level, const char *fmt,
e4418354
DB
48 va_list ap)
49 G_GNUC_PRINTF(2, 0);
ee46c789
DDAG
50
51/**
52 * Install a custom log handler function.
53 *
54 * Log messages are emitted by libfuse functions to report errors and debug
55 * information. Messages are printed to stderr by default but this can be
56 * overridden by installing a custom log message handler function.
57 *
58 * The log message handler function is global and affects all FUSE filesystems
59 * created within this process.
60 *
61 * @param func a custom log message handler function or NULL to revert to
62 * the default
63 */
64void fuse_set_log_func(fuse_log_func_t func);
65
66/**
67 * Emit a log message
68 *
69 * @param level severity level (FUSE_LOG_ERR, FUSE_LOG_DEBUG, etc)
70 * @param fmt sprintf-style format string including newline
71 */
e4418354
DB
72void fuse_log(enum fuse_log_level level, const char *fmt, ...)
73 G_GNUC_PRINTF(2, 3);
ee46c789 74
ee46c789 75#endif /* FUSE_LOG_H_ */