diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2023-03-09 07:22:49 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2024-04-09 05:41:03 +0200 |
commit | c71e1cf11d370795acd4fdeb6df7edbc32372a74 (patch) | |
tree | b487039c3040a14d8e982e721f95caf096d82799 | |
parent | d8aeb3edc6d79c815ec0ba8e506f502741368a9c (diff) |
logging: test timestamp formats
Show what timestamp formats we currently feature.
Upcoming patch Icbd5192ea835e24b12fe057cc1ab56e9572d75c0 adds a new
timestamp format.
Change-Id: If3dbf3006a454d4e8a5c758e5c884e12c8bb1fc1
-rw-r--r-- | tests/logging/logging_vty_test.c | 13 | ||||
-rw-r--r-- | tests/logging/logging_vty_test.vty | 45 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/logging/logging_vty_test.c b/tests/logging/logging_vty_test.c index 5bb5aaae..95e2f3a1 100644 --- a/tests/logging/logging_vty_test.c +++ b/tests/logging/logging_vty_test.c @@ -25,6 +25,7 @@ #include <osmocom/core/logging.h> #include <osmocom/core/utils.h> #include <osmocom/core/application.h> +#include <osmocom/core/timer.h> #include <osmocom/vty/command.h> #include <osmocom/vty/logging.h> @@ -78,9 +79,18 @@ DEFUN(log_sweep, log_sweep_cmd, return CMD_SUCCESS; } +DEFUN(log_test, log_test_cmd, + "log-test", + "Log one DEBUG on category 'aa'\n") +{ + LOGP(DAA, LOGL_DEBUG, ":)\n"); + return CMD_SUCCESS; +} + static void vty_commands_init(void) { install_element_ve(&log_sweep_cmd); + install_element_ve(&log_test_cmd); } static const struct log_info_cat default_categories[] = { @@ -280,6 +290,9 @@ int main(int argc, char **argv) } } + osmo_gettimeofday_override = true; + osmo_gettimeofday_override_time = (struct timeval){ 306968100, 423423423 }; + while (!quit) { log_reset_context(); osmo_select_main(0); diff --git a/tests/logging/logging_vty_test.vty b/tests/logging/logging_vty_test.vty index ddbfb7b3..22531b09 100644 --- a/tests/logging/logging_vty_test.vty +++ b/tests/logging/logging_vty_test.vty @@ -255,6 +255,51 @@ logging_vty_test(config-log)# exit logging_vty_test(config)# no log stderr logging_vty_test(config)# exit +logging_vty_test# logging timezone utc + +logging_vty_test# log-test +DAA DEBUG :) + +logging_vty_test# logging print timestamp ctime +logging_vty_test# log-test +Sun Sep 23 20:55:00 1979 DAA DEBUG :) + +logging_vty_test# logging print timestamp date-packed +logging_vty_test# log-test +19790923205500423423 DAA DEBUG :) + +logging_vty_test# logging print timestamp none +logging_vty_test# log-test +DAA DEBUG :) + +logging_vty_test# ### Legacy cmds still work: 'logging timestamp' and 'logging print extended-timestamp' +logging_vty_test# logging timestamp 1 +% Deprecated: do not use 'logging timestamp (0|1)' anymore, instead use 'logging print timestamp (none|ctime)' +logging_vty_test# log-test +Sun Sep 23 20:55:00 1979 DAA DEBUG :) + +logging_vty_test# logging print extended-timestamp 1 +% Deprecated: do not use 'logging print extended-timestamp (0|1)' anymore, instead use 'logging print timestamp (none|date-packed)' +logging_vty_test# log-test +19790923205500423423 DAA DEBUG :) + +logging_vty_test# logging timestamp 0 +% Deprecated: do not use 'logging timestamp (0|1)' anymore, instead use 'logging print timestamp (none|ctime)' +logging_vty_test# log-test +19790923205500423423 DAA DEBUG :) + +logging_vty_test# logging timestamp 1 +% Deprecated: do not use 'logging timestamp (0|1)' anymore, instead use 'logging print timestamp (none|ctime)' +logging_vty_test# logging print extended-timestamp 0 +% Deprecated: do not use 'logging print extended-timestamp (0|1)' anymore, instead use 'logging print timestamp (none|date-packed)' +logging_vty_test# log-test +Sun Sep 23 20:55:00 1979 DAA DEBUG :) + +logging_vty_test# logging timestamp 0 +% Deprecated: do not use 'logging timestamp (0|1)' anymore, instead use 'logging print timestamp (none|ctime)' +logging_vty_test# log-test +DAA DEBUG :) + logging_vty_test# log-sweep DAA DEBUG Log message for DAA on level LOGL_DEBUG DAA INFO Log message for DAA on level LOGL_INFO |