From 7ae06e8e2c606b1ecbe12d4b6ed2a76552821f74 Mon Sep 17 00:00:00 2001 From: Kryzek Date: Sun, 17 Nov 2019 19:33:46 +0200 Subject: [PATCH] Customizable timestamp Add a customizable timestamp --- lib/util/logger.js | 2 +- lib/util/settings.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/util/logger.js b/lib/util/logger.js index 19818b00b..e7c53bd7d 100644 --- a/lib/util/logger.js +++ b/lib/util/logger.js @@ -15,7 +15,7 @@ const directory = settings.get().advanced.log_directory.replace('%TIMESTAMP%', t fx.mkdirSync(directory); // Determine the log level. -const level = settings.get().advanced.log_level; +const timestampFormat = () => moment().format(settings.get().advanced.timestamp_format); const levelWithCompensatedLength = { 'info': 'info ', diff --git a/lib/util/settings.js b/lib/util/settings.js index 54db78275..1b78af16c 100644 --- a/lib/util/settings.js +++ b/lib/util/settings.js @@ -99,6 +99,13 @@ const defaults = { * Home Assistant status topic */ homeassistant_status_topic: 'hass/status', + + /** + * Configurable timestampFormat + * https://github.com/Koenkk/zigbee2mqtt/commit/44db557a0c83f419d66755d14e460cd78bd6204e + */ + timestamp_format: 'YYYY-MM-DD HH:mm:ss', + }, }; @@ -152,6 +159,7 @@ const schema = { report: {type: 'boolean'}, homeassistant_discovery_topic: {type: 'string'}, homeassistant_status_topic: {type: 'string'}, + timestamp_format: {type: 'string'}, }, }, map_options: {