]> git.saurik.com Git - apple/hfs.git/blob - livefiles_cs_plugin/lf_cs_logging.h
hfs-556.41.1.tar.gz
[apple/hfs.git] / livefiles_cs_plugin / lf_cs_logging.h
1 //
2 // Copyright (c) 2009-2019 Apple Inc. All rights reserved.
3 //
4 // lf_cs_logging.h - Defines for helper methods for logging info, error,
5 // warning and debug messages for livefiles Apple_CoreStorage
6 // plugin.
7 //
8 #ifndef _LF_CS_LOGGING_H
9 #define _LF_CS_LOGGING_H
10
11 #if LF_CS_USE_OSLOG
12 #include <os/log.h>
13
14 #define debugmsg(fmt, ...) \
15 os_log_debug(OS_LOG_DEFAULT, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
16 #define infomsg(fmt, ...) \
17 os_log_info(OS_LOG_DEFAULT, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
18 #define warnmsg(fmt, ...) \
19 os_log(OS_LOG_DEFAULT, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
20 #define errmsg(fmt, ...) \
21 os_log_error(OS_LOG_DEFAULT, "%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
22
23 #else /* !LF_CS_USE_OSLOG */
24
25 void log_debug(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
26 void log_info(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
27 void log_warn(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
28 void log_err(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
29
30 #define debugmsg(fmt, ...) \
31 log_debug("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
32 #define infomsg(fmt, ...) \
33 log_info("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
34 #define warnmsg(fmt, ...) \
35 log_warn("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
36 #define errmsg(fmt, ...) \
37 log_err("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)
38
39 #endif /* LF_CS_USE_OSLOG */
40 #endif /* _LF_CS_LOGGING_H */