summaryrefslogtreecommitdiff
path: root/lib/zlog.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2021-05-03 10:40:54 +0200
committerGitHub <noreply@github.com>2021-05-03 10:40:54 +0200
commit9cd090488c9f25572797e7a6c9dbec204055153f (patch)
treeb9c5434f06e466c8deb3a2f9c09963d8f67a7be1 /lib/zlog.c
parentc8b084aab720a50dce4593412987e1a85e25e359 (diff)
parent7c945dff610ae526d536b752becdd1555c0d4bfb (diff)
Merge pull request #8479 from mjstapp/zlog_immediate
Diffstat (limited to 'lib/zlog.c')
-rw-r--r--lib/zlog.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/zlog.c b/lib/zlog.c
index 24800c6e64..a99fd71f0d 100644
--- a/lib/zlog.c
+++ b/lib/zlog.c
@@ -81,6 +81,11 @@ static gid_t zlog_gid = -1;
DECLARE_ATOMLIST(zlog_targets, struct zlog_target, head);
static struct zlog_targets_head zlog_targets;
+/* Global setting for buffered vs immediate output. The default is
+ * per-pthread buffering.
+ */
+static bool default_immediate;
+
/* cf. zlog.h for additional comments on this struct.
*
* Note: you MUST NOT pass the format string + va_list to non-FRR format
@@ -395,7 +400,7 @@ static void vzlog_tls(struct zlog_tls *zlog_tls, const struct xref_logmsg *xref,
struct zlog_msg *msg;
char *buf;
bool ignoremsg = true;
- bool immediate = false;
+ bool immediate = default_immediate;
/* avoid further processing cost if no target wants this message */
rcu_read_lock();
@@ -714,6 +719,14 @@ struct zlog_target *zlog_target_replace(struct zlog_target *oldzt,
return oldzt;
}
+/*
+ * Enable or disable 'immediate' output - default is to buffer
+ * each pthread's messages.
+ */
+void zlog_set_immediate(bool set_p)
+{
+ default_immediate = set_p;
+}
/* common init */