diff options
author | Gergely Nagy <algernon@balabit.hu> | 2012-03-21 14:23:35 +0100 |
---|---|---|
committer | Gergely Nagy <algernon@balabit.hu> | 2012-03-21 14:23:35 +0100 |
commit | b49beb4e96a317e9d279274dc13607dda978792c (patch) | |
tree | 9486077d17f0bd39fd480a5c9e3815c2582e0481 /t | |
parent | 765ee19aec8a9a88c52f71336aadbc8991e8cb95 (diff) | |
download | libumberlog-b49beb4e96a317e9d279274dc13607dda978792c.tar.gz libumberlog-b49beb4e96a317e9d279274dc13607dda978792c.tar.xz libumberlog-b49beb4e96a317e9d279274dc13607dda978792c.zip |
Add the timestamp to the JSON payload too.
Add high-precision timestamp to the JSON payload (unless disabled).
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Diffstat (limited to 't')
-rw-r--r-- | t/test_cee_format.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/test_cee_format.c b/t/test_cee_format.c index 145c810..ec48603 100644 --- a/t/test_cee_format.c +++ b/t/test_cee_format.c @@ -78,6 +78,7 @@ test_simple (void) verify_value_exists (jo, "pid"); verify_value_exists (jo, "uid"); verify_value_exists (jo, "gid"); + verify_value_exists (jo, "timestamp"); verify_value (jo, "host", host); json_object_put (jo); @@ -105,6 +106,7 @@ test_no_discover (void) verify_value_missing (jo, "uid"); verify_value_missing (jo, "gid"); verify_value_missing (jo, "host"); + verify_value_missing (jo, "timestamp"); json_object_put (jo); @@ -160,6 +162,33 @@ test_discover_priority (void) closelog (); } +static void +test_no_timestamp (void) +{ + char *msg; + struct json_object *jo; + + openlog ("cee-syslog/test_no_timestamp", LOG_CEE_NOTIME, LOG_LOCAL0); + + msg = cee_format (LOG_DEBUG, "hello, I'm %s!", __FUNCTION__, NULL); + jo = parse_msg (msg); + free (msg); + + verify_value (jo, "msg", "hello, I'm test_no_timestamp!"); + verify_value (jo, "facility", "local0"); + verify_value (jo, "priority", "debug"); + verify_value (jo, "program", "cee-syslog/test_no_timestamp"); + verify_value_exists (jo, "pid"); + verify_value_exists (jo, "uid"); + verify_value_exists (jo, "gid"); + verify_value_missing (jo, "timestamp"); + verify_value_exists (jo, "host"); + + json_object_put (jo); + + closelog (); +} + int main (void) { @@ -167,6 +196,7 @@ main (void) test_no_discover (); test_additional_fields (); test_discover_priority (); + test_no_timestamp (); return 0; } |