Skip to content

Commit e640e45

Browse files
committed
윈스턴 로거 타임스탬프 서버 오픈시간으로 고정되는 문제 수정
1 parent a68ad47 commit e640e45

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/logger.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ const { createLogger, format, transports } = winston;
1010
const { combine, timestamp, colorize, printf, simple, json, logstash } =
1111
winston.format;
1212

13-
const now = moment().format('YYYY-MM-DD HH:mm:ss');
14-
1513
export default class Logger {
1614
private logger: winston.Logger;
1715
private cloudWatchClient: CloudWatchLogsClient;
@@ -45,7 +43,7 @@ export default class Logger {
4543
format: 'YYYY-MM-DD HH:mm:ss',
4644
}),
4745
printf((info) => {
48-
return `[${info.timestamp}] [${info.level}] [${this.category}] : ${info.message}`;
46+
return `[${info.timestamp}] [${process.env.NODE_ENV}] [${info.level}] [${this.category}] : ${info.message}`;
4947
}),
5048
),
5149
}),
@@ -68,6 +66,7 @@ export default class Logger {
6866
}
6967

7068
public info(msg: string, metadata: string = '') {
69+
const now = moment().format('YYYY-MM-DD HH:mm:ss');
7170
this.logger.info(msg);
7271
if (this.is_production) {
7372
const info = {
@@ -81,6 +80,7 @@ export default class Logger {
8180
}
8281
}
8382
public error(errMsg: string, metadata: string = '') {
83+
const now = moment().format('YYYY-MM-DD HH:mm:ss');
8484
this.logger.error(errMsg);
8585
if (this.is_production) {
8686
const info = {
@@ -97,6 +97,7 @@ export default class Logger {
9797
this.logger.debug(debugMsg);
9898
}
9999
public warn(warnMsg: string, metadata: string = '') {
100+
const now = moment().format('YYYY-MM-DD HH:mm:ss');
100101
this.logger.warn(warnMsg);
101102
if (this.is_production) {
102103
const info = {

0 commit comments

Comments
 (0)