xref: /netbsd-src/lib/librefuse/fuse_log.h (revision 153b9c141b7fa8d0ca419b1eaa9ba2e20af69b34)
1*153b9c14Spho /* $NetBSD: fuse_log.h,v 1.1 2022/01/22 07:39:22 pho Exp $ */
2*153b9c14Spho 
3*153b9c14Spho /*
4*153b9c14Spho  * Copyright (c) 2021 The NetBSD Foundation, Inc.
5*153b9c14Spho  * All rights reserved.
6*153b9c14Spho  *
7*153b9c14Spho  * Redistribution and use in source and binary forms, with or without
8*153b9c14Spho  * modification, are permitted provided that the following conditions
9*153b9c14Spho  * are met:
10*153b9c14Spho  * 1. Redistributions of source code must retain the above copyright
11*153b9c14Spho  *    notice, this list of conditions and the following disclaimer.
12*153b9c14Spho  * 2. Redistributions in binary form must reproduce the above copyright
13*153b9c14Spho  *    notice, this list of conditions and the following disclaimer in the
14*153b9c14Spho  *    documentation and/or other materials provided with the distribution.
15*153b9c14Spho  * 3. The name of the author may not be used to endorse or promote
16*153b9c14Spho  *    products derived from this software without specific prior written
17*153b9c14Spho  *    permission.
18*153b9c14Spho  *
19*153b9c14Spho  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20*153b9c14Spho  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21*153b9c14Spho  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*153b9c14Spho  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23*153b9c14Spho  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*153b9c14Spho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25*153b9c14Spho  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*153b9c14Spho  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*153b9c14Spho  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28*153b9c14Spho  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29*153b9c14Spho  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*153b9c14Spho  */
31*153b9c14Spho #if !defined(_FUSE_LOG_H_)
32*153b9c14Spho #define _FUSE_LOG_H_
33*153b9c14Spho 
34*153b9c14Spho /* FUSE logging API, appeared on FUSE 3.7. */
35*153b9c14Spho 
36*153b9c14Spho #include <stdarg.h>
37*153b9c14Spho #include <sys/cdefs.h>
38*153b9c14Spho 
39*153b9c14Spho #ifdef __cplusplus
40*153b9c14Spho extern "C" {
41*153b9c14Spho #endif
42*153b9c14Spho 
43*153b9c14Spho enum fuse_log_level {
44*153b9c14Spho 	FUSE_LOG_EMERG,
45*153b9c14Spho 	FUSE_LOG_ALERT,
46*153b9c14Spho 	FUSE_LOG_CRIT,
47*153b9c14Spho 	FUSE_LOG_ERR,
48*153b9c14Spho 	FUSE_LOG_WARNING,
49*153b9c14Spho 	FUSE_LOG_NOTICE,
50*153b9c14Spho 	FUSE_LOG_INFO,
51*153b9c14Spho 	FUSE_LOG_DEBUG
52*153b9c14Spho };
53*153b9c14Spho 
54*153b9c14Spho typedef void (*fuse_log_func_t)(enum fuse_log_level level, const char *fmt, va_list ap);
55*153b9c14Spho 
56*153b9c14Spho void fuse_set_log_func(fuse_log_func_t func);
57*153b9c14Spho void fuse_log(enum fuse_log_level level, const char *fmt, ...) __printflike(2, 3);
58*153b9c14Spho 
59*153b9c14Spho #ifdef __cplusplus
60*153b9c14Spho }
61*153b9c14Spho #endif
62*153b9c14Spho 
63*153b9c14Spho #endif
64