Skip to content

Commit

Permalink
Customizable timestamp (#2357)
Browse files Browse the repository at this point in the history
* Customizable timestamp

Add a customizable timestamp

* Revert "Customizable timestamp"

This reverts commit 7ae06e8.

* Customizable timestamp

* Update settings.js
  • Loading branch information
Kryzek authored and Koenkk committed Nov 17, 2019
1 parent 22c8f14 commit 878a886
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/util/logger.js
Expand Up @@ -25,7 +25,7 @@ const levelWithCompensatedLength = {
};

/* istanbul ignore next */
const timestampFormat = () => moment().format('YYYY-MM-DD HH:mm:ss');
const timestampFormat = () => moment().format(settings.get().advanced.timestamp_format);

// Create logger
const transports = {
Expand Down
7 changes: 7 additions & 0 deletions lib/util/settings.js
Expand Up @@ -99,6 +99,12 @@ 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',
},
};

Expand Down Expand Up @@ -152,6 +158,7 @@ const schema = {
report: {type: 'boolean'},
homeassistant_discovery_topic: {type: 'string'},
homeassistant_status_topic: {type: 'string'},
timestamp_format: {type: 'string'},
},
},
map_options: {
Expand Down

0 comments on commit 878a886

Please sign in to comment.