Jeremy Kerr | 3d36ee2 | 2019-05-30 11:15:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 2 | |
| 3 | #ifndef _LIBMCTP_LOG_H |
| 4 | #define _LIBMCTP_LOG_H |
| 5 | |
| 6 | /* libmctp-internal logging */ |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 7 | |
Jeremy Kerr | c7e764a | 2019-05-28 16:49:03 +0800 | [diff] [blame] | 8 | void mctp_prlog(int level, const char *fmt, ...) |
Jeremy Kerr | 5134f0e | 2019-03-06 09:10:43 +0800 | [diff] [blame] | 9 | __attribute__((format(printf, 2, 3))); |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 10 | |
Andrew Jeffery | 6f3630d | 2020-05-22 16:05:58 +0930 | [diff] [blame] | 11 | #ifndef pr_fmt |
| 12 | #define pr_fmt(x) x |
| 13 | #endif |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 14 | |
Andrew Jeffery | 6f3630d | 2020-05-22 16:05:58 +0930 | [diff] [blame] | 15 | #define mctp_prerr(fmt, ...) \ |
| 16 | mctp_prlog(MCTP_LOG_ERR, pr_fmt(fmt), ##__VA_ARGS__) |
| 17 | #define mctp_prwarn(fmt, ...) \ |
| 18 | mctp_prlog(MCTP_LOG_WARNING, pr_fmt(fmt), ##__VA_ARGS__) |
| 19 | #define mctp_prinfo(fmt, ...) \ |
| 20 | mctp_prlog(MCTP_LOG_INFO, pr_fmt(fmt), ##__VA_ARGS__) |
| 21 | #define mctp_prdebug(fmt, ...) \ |
| 22 | mctp_prlog(MCTP_LOG_DEBUG, pr_fmt(fmt), ##__VA_ARGS__) |
Jeremy Kerr | 4cdc200 | 2019-02-07 16:49:12 +0800 | [diff] [blame] | 23 | |
| 24 | #endif /* _LIBMCTP_LOG_H */ |