Skip to content

Commit

Permalink
Customizable timestamp
Browse files Browse the repository at this point in the history
Add a customizable timestamp
  • Loading branch information
Kryzek committed Nov 17, 2019
1 parent d2c4133 commit 7ae06e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/util/logger.js
Expand Up @@ -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 ',
Expand Down
8 changes: 8 additions & 0 deletions lib/util/settings.js
Expand Up @@ -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',

},
};

Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 7ae06e8

Please sign in to comment.