Skip to content

Commit

Permalink
change logger time zone
Browse files Browse the repository at this point in the history
  • Loading branch information
blueBlue0102 committed Jun 10, 2021
1 parent 42d9fe1 commit 7458f16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ const { format, transports } = winston;

const logger = winston.createLogger({
level: "info",
format: format.combine(format.timestamp(), format.json()),
format: format.combine(
format.timestamp({
format: new Date().toLocaleString([], { timeZone: "Asia/Taipei" }),
}),
format.json()
),
transports: [
new transports.File({ filename: "log/error.log", level: "error" }),
new transports.File({ filename: "log/warn.log", level: "warn" }),
Expand Down

0 comments on commit 7458f16

Please sign in to comment.