From c6610ea98f44ed2d5d9556076322d3a6a9023675 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sun, 11 Apr 2021 18:23:16 +0200 Subject: [PATCH] lib: make a few log symbols accessible Might've made a few things too many `static` there. Signed-off-by: David Lamparter --- lib/log_vty.c | 13 ++++++++++--- lib/log_vty.h | 3 +++ lib/zlog.h | 5 +++++ lib/zlog_targets.c | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/log_vty.c b/lib/log_vty.c index 7057a06c51..cbb8de8976 100644 --- a/lib/log_vty.c +++ b/lib/log_vty.c @@ -58,7 +58,7 @@ static struct zlog_cfg_filterfile zt_filterfile = { }, }; -static const char *zlog_progname; +const char *zlog_progname; static const char *zlog_protoname; static const struct facility_map { @@ -95,7 +95,14 @@ static const char * const zlog_priority[] = { "notifications", "informational", "debugging", NULL, }; -static const char *facility_name(int facility) +const char *zlog_priority_str(int priority) +{ + if (priority > LOG_DEBUG) + return "???"; + return zlog_priority[priority]; +} + +const char *facility_name(int facility) { const struct facility_map *fm; @@ -105,7 +112,7 @@ static const char *facility_name(int facility) return ""; } -static int facility_match(const char *str) +int facility_match(const char *str) { const struct facility_map *fm; diff --git a/lib/log_vty.h b/lib/log_vty.h index 913ff5f88e..db46b3cb5b 100644 --- a/lib/log_vty.h +++ b/lib/log_vty.h @@ -34,6 +34,9 @@ extern void log_config_write(struct vty *vty); extern int log_level_match(const char *s); extern void log_show_syslog(struct vty *vty); +extern int facility_match(const char *str); +extern const char *facility_name(int facility); + DECLARE_HOOK(zlog_rotate, (), ()); extern void zlog_rotate(void); diff --git a/lib/zlog.h b/lib/zlog.h index ecc30f09b2..d9c8952ac5 100644 --- a/lib/zlog.h +++ b/lib/zlog.h @@ -37,10 +37,13 @@ extern "C" { #endif +DECLARE_MGROUP(LOG); + extern char zlog_prefix[]; extern size_t zlog_prefixsz; extern int zlog_tmpdirfd; extern int zlog_instance; +extern const char *zlog_progname; struct xref_logmsg { struct xref xref; @@ -274,6 +277,8 @@ extern void zlog_tls_buffer_fini(void); /* Enable or disable 'immediate' output - default is to buffer messages. */ extern void zlog_set_immediate(bool set_p); +extern const char *zlog_priority_str(int priority); + #ifdef __cplusplus } #endif diff --git a/lib/zlog_targets.c b/lib/zlog_targets.c index 127de12240..48785ad298 100644 --- a/lib/zlog_targets.c +++ b/lib/zlog_targets.c @@ -31,7 +31,6 @@ * absolute end. */ -DECLARE_MGROUP(LOG); DEFINE_MGROUP_ACTIVEATEXIT(LOG, "logging subsystem"); DEFINE_MTYPE_STATIC(LOG, LOG_FD, "log file target"); -- 2.39.5