Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2020-04-20 14:56:00 +0300
committerVladislavs Sokurenko <vladislavs.sokurenko@zabbix.com>2020-04-20 14:56:00 +0300
commitb5bb46bd006f66f4f6fa832718cc84d535269c7b (patch)
treead7f602d8e9bb12c0853048680c11fc952a02366 /src/libs/zbxembed/zabbix.c
parentf9151189023ad710297b51bed8391ed4bec44707 (diff)
........S. [ZBXNEXT-5877] added milliseconds since start to logs
Diffstat (limited to 'src/libs/zbxembed/zabbix.c')
-rw-r--r--src/libs/zbxembed/zabbix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libs/zbxembed/zabbix.c b/src/libs/zbxembed/zabbix.c
index 6dea5cfbed7..14ffff0ed14 100644
--- a/src/libs/zbxembed/zabbix.c
+++ b/src/libs/zbxembed/zabbix.c
@@ -70,6 +70,7 @@ static duk_ret_t es_zabbix_log(duk_context *ctx)
const char *message;
int level;
duk_memory_functions out_funcs;
+ struct timeval tv;
level = duk_to_int(ctx, 0);
message = duk_to_string(ctx, 1);
@@ -84,6 +85,10 @@ static duk_ret_t es_zabbix_log(duk_context *ctx)
zbx_json_addobject(env->json, NULL);
zbx_json_adduint64(env->json, "level", (zbx_uint64_t)level);
+
+ gettimeofday(&tv, NULL);
+ zbx_json_adduint64(env->json, "ms", (tv.tv_sec - env->start_time.tv_sec) * 1000 +
+ (tv.tv_usec - env->start_time.tv_usec) / 1000);
zbx_json_addstring(env->json, "message", message, ZBX_JSON_TYPE_STRING);
zbx_json_close(env->json);