mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-20 02:21:20 +00:00
Log in local timezone. https://github.com/Koenkk/zigbee2mqtt/issues/2341
This commit is contained in:
+4
-2
@@ -24,6 +24,8 @@ const levelWithCompensatedLength = {
|
||||
'debug': 'debug',
|
||||
};
|
||||
|
||||
const timestampFormat = () => moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
// Create logger
|
||||
const transports = {
|
||||
file: new winston.transports.File({
|
||||
@@ -33,7 +35,7 @@ const transports = {
|
||||
maxFiles: 3, // Keep last 3 files
|
||||
maxsize: 10000000, // 10MB
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
winston.format.timestamp({format: timestampFormat}),
|
||||
winston.format.printf(/* istanbul ignore next */(info) => {
|
||||
const {timestamp, level, message} = info;
|
||||
return `${levelWithCompensatedLength[level]} ${timestamp.split('.')[0]}: ${message}`;
|
||||
@@ -43,7 +45,7 @@ const transports = {
|
||||
console: new winston.transports.Console({
|
||||
level,
|
||||
format: winston.format.combine(
|
||||
winston.format.timestamp(),
|
||||
winston.format.timestamp({format: timestampFormat}),
|
||||
winston.format.printf(/* istanbul ignore next */(info) => {
|
||||
const {timestamp, level, message} = info;
|
||||
const prefix = colorizer.colorize(level, `zigbee2mqtt:${levelWithCompensatedLength[level]}`);
|
||||
|
||||
Reference in New Issue
Block a user