summaryrefslogtreecommitdiffstats
path: root/lib/log.h
diff options
context:
space:
mode:
authorManoj Naragund <mnaragund@vmware.com>2022-11-21 14:04:46 +0100
committerManoj Naragund <mnaragund@vmware.com>2023-01-20 06:03:03 +0100
commit701f4f616a6b43b35392a7e852dcbcc9d880165a (patch)
treefb52391ff08ce477027da368ba0eb566eb0f07ba /lib/log.h
parentospfd: generation of indication LSAs on area border routers. (diff)
downloadfrr-701f4f616a6b43b35392a7e852dcbcc9d880165a.tar.xz
frr-701f4f616a6b43b35392a7e852dcbcc9d880165a.zip
ospfd: addition of OSPF_LOG.
Description: Addition of OSPF_LOG for conditionally logging ospf messages, at different log levels. Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
Diffstat (limited to 'lib/log.h')
-rw-r--r--lib/log.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/log.h b/lib/log.h
index 3011fa9a9..5fb7ee030 100644
--- a/lib/log.h
+++ b/lib/log.h
@@ -129,6 +129,21 @@ extern int proto_redistnum(int afi, const char *s);
extern const char *zserv_command_string(unsigned int command);
+#define OSPF_LOG(level, cond, fmt, ...) \
+ do { \
+ if (cond) \
+ zlog_##level(fmt, ##__VA_ARGS__); \
+ } while (0)
+
+#define OSPF_LOG_ERR(fmt, ...) OSPF_LOG(err, true, fmt, ##__VA_ARGS__)
+
+#define OSPF_LOG_WARN(fmt, ...) OSPF_LOG(warn, true, fmt, ##__VA_ARGS__)
+
+#define OSPF_LOG_INFO(fmt, ...) OSPF_LOG(info, true, fmt, ##__VA_ARGS__)
+
+#define OSPF_LOG_DEBUG(cond, fmt, ...) OSPF_LOG(debug, cond, fmt, ##__VA_ARGS__)
+
+#define OSPF_LOG_NOTICE(fmt, ...) OSPF_LOG(notice, true, fmt, ##__VA_ARGS__)
/* structure useful for avoiding repeated rendering of the same timestamp */
struct timestamp_control {