xref: /linux/drivers/infiniband/ulp/rtrs/rtrs-log.h (revision f788bb2fb915a79eae0a160580766ba52984d61f)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * RDMA Transport Layer
4  *
5  * Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
6  * Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
7  * Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
8  */
9 #ifndef RTRS_LOG_H
10 #define RTRS_LOG_H
11 
12 #define rtrs_log(fn, obj, fmt, ...)				\
13 	fn("<%s>: " fmt, obj->sessname, ##__VA_ARGS__)
14 
15 #define rtrs_err(obj, fmt, ...)	\
16 	rtrs_log(pr_err, obj, fmt, ##__VA_ARGS__)
17 #define rtrs_err_rl(obj, fmt, ...)	\
18 	rtrs_log(pr_err_ratelimited, obj, fmt, ##__VA_ARGS__)
19 #define rtrs_wrn(obj, fmt, ...)	\
20 	rtrs_log(pr_warn, obj, fmt, ##__VA_ARGS__)
21 #define rtrs_wrn_rl(obj, fmt, ...) \
22 	rtrs_log(pr_warn_ratelimited, obj, fmt, ##__VA_ARGS__)
23 #define rtrs_info(obj, fmt, ...) \
24 	rtrs_log(pr_info, obj, fmt, ##__VA_ARGS__)
25 #define rtrs_info_rl(obj, fmt, ...) \
26 	rtrs_log(pr_info_ratelimited, obj, fmt, ##__VA_ARGS__)
27 
28 #endif /* RTRS_LOG_H */
29