aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-01-18 01:38:14 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2024-06-05 04:23:37 +0200
commit699c7f57f9b1b63cfe7d4b9afa7faa89d41d76b5 (patch)
treef53fcf7c94aadab7dad2d071db818d449d38bea5 /include/osmocom
parent72d540d13cc0d637a357bf92da5247ff029484f6 (diff)
logging vty: add 'logging print timestamp', deprecate other timestamp cmds
Deprecate previous logging timestamp config commands: logging timestamp (0|1) logging print extended-timestamp (0|1) Add new single timestamp configuration command: logging print timestamp (none|date-packed|ctime) Another format called 'date' is added in patch Icbd5192ea835e24b12fe057cc1ab56e9572d75c0. The idea is to have these date formats: date 2018-01-16,01:44:34.681 (new, "best" format) date-packed 20180116014434681 (current 'print extended-timestamp 1') ctime Sun Jan 1 01:44:34 2018 (current 'timestamp 1') Change-Id: I58c792dda3cbcf8618648ba4429c27fa398a9e15
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/core/logging.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 26162bff..623b9319 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -10,6 +10,7 @@
#include <stdbool.h>
#include <osmocom/core/defs.h>
#include <osmocom/core/linuxlist.h>
+#include <osmocom/core/utils.h>
extern struct log_info *osmo_log_info;
@@ -303,6 +304,19 @@ enum log_timestamp_format {
LOG_TIMESTAMP_CTIME,
};
+/*! Mapping between enum log_timestamp_format and strings. */
+extern const struct value_string log_timestamp_format_names[];
+/*! Map enum log_timestamp_format values to string constants. */
+static inline const char *log_timestamp_format_name(enum log_timestamp_format ltf)
+{
+ return get_value_string(log_timestamp_format_names, ltf);
+}
+/*! Map string constants to enum log_timestamp_format values. */
+static inline enum log_timestamp_format log_timestamp_format_val(const char *str)
+{
+ return (enum log_timestamp_format)get_string_value(log_timestamp_format_names, str);
+}
+
/*! structure representing a logging target */
struct log_target {
struct llist_head entry; /*!< linked list */