lib: add build option to set startup log timestemp precision

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2023-04-28 11:10:56 -04:00
parent 8bc79f3855
commit 6b7481aa8d
2 changed files with 22 additions and 4 deletions

View File

@ -691,6 +691,8 @@ AC_ARG_ENABLE([ospfapi],
AC_ARG_ENABLE([ospfclient],
AS_HELP_STRING([--disable-ospfclient], [do not build OSPFAPI client for OSPFAPI,
(this is the default if --disable-ospfapi is set)]))
AC_ARG_WITH([log_timestamp_precision],
AS_HELP_STRING([--with-log-timestamp-precision=ARG], [set startup log timestamp precision, ARG must be 0-12]))
AC_ARG_ENABLE([multipath],
AS_HELP_STRING([--enable-multipath=ARG], [enable multipath function, ARG must be digit]))
AC_ARG_WITH([service_timeout],
@ -962,8 +964,19 @@ esac
AC_DEFINE_UNQUOTED([MULTIPATH_NUM], [$MPATH_NUM], [Maximum number of paths for a route])
AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use])
case "${with_log_timestamp_precision}" in
[[0-9]|1[012]])
;;
"")
;;
*)
AC_MSG_FAILURE([Please specify a number from 0-12 for log precision ARG])
;;
esac
with_log_timestamp_precision=${with_log_timestamp_precision:-0}
AC_DEFINE_UNQUOTED([LOG_TIMESTAMP_PRECISION], [${with_log_timestamp_precision}], [Startup zlog timestamp precision])
AC_DEFINE_UNQUOTED([VTYSH_PAGER], ["$VTYSH_PAGER"], [What pager to use])
TIMEOUT_MIN=2
case "${with_service_timeout}" in

View File

@ -34,18 +34,23 @@ static int log_cmdline_syslog_lvl = ZLOG_DISABLED;
static struct zlog_cfg_file zt_file_cmdline = {
.prio_min = ZLOG_DISABLED,
.ts_subsec = LOG_TIMESTAMP_PRECISION,
};
static struct zlog_cfg_file zt_file = {
.prio_min = ZLOG_DISABLED,
.ts_subsec = LOG_TIMESTAMP_PRECISION,
};
static struct zlog_cfg_filterfile zt_filterfile = {
.parent = {
.prio_min = ZLOG_DISABLED,
},
.parent =
{
.prio_min = ZLOG_DISABLED,
.ts_subsec = LOG_TIMESTAMP_PRECISION,
},
};
static struct zlog_cfg_file zt_stdout_file = {
.prio_min = ZLOG_DISABLED,
.ts_subsec = LOG_TIMESTAMP_PRECISION,
};
static struct zlog_cfg_5424 zt_stdout_journald = {
.prio_min = ZLOG_DISABLED,