blob: 1e574e5ee2aa9f52bbfa86768592ff080b3d2859 [file] [log] [blame]
Jeremy Kerr3d36ee22019-05-30 11:15:37 +08001/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
Jeremy Kerr4cdc2002019-02-07 16:49:12 +08002
3#ifndef _LIBMCTP_LOG_H
4#define _LIBMCTP_LOG_H
5
6/* libmctp-internal logging */
Jeremy Kerr4cdc2002019-02-07 16:49:12 +08007
Jeremy Kerrc7e764a2019-05-28 16:49:03 +08008void mctp_prlog(int level, const char *fmt, ...)
Jeremy Kerr5134f0e2019-03-06 09:10:43 +08009 __attribute__((format(printf, 2, 3)));
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080010
Andrew Jeffery6f3630d2020-05-22 16:05:58 +093011#ifndef pr_fmt
12#define pr_fmt(x) x
13#endif
Jeremy Kerr4cdc2002019-02-07 16:49:12 +080014
Andrew Jeffery6f3630d2020-05-22 16:05:58 +093015#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 Kerr4cdc2002019-02-07 16:49:12 +080023
24#endif /* _LIBMCTP_LOG_H */