Winston: λ™μΌν•œ 둜거 λ‚΄μ—μ„œ μ „μ†‘λ³„λ‘œ ν˜•μ‹ ꡬ성 ν—ˆμš©

에 λ§Œλ“  2018λ…„ 07μ›” 08일  Β·  5μ½”λ©˜νŠΈ  Β·  좜처: winstonjs/winston

κΈ°λŠ₯은 λ¬΄μ—‡μž…λ‹ˆκΉŒ?

μ½˜μ†” 전솑이 μžˆλŠ” λ‘œκ±°μ™€ ν΄λΌμš°λ“œ 기반 λ‘œκΉ… μ„œλΉ„μŠ€λ‘œ μ΄λ™ν•˜λŠ” 또 λ‹€λ₯Έ 전솑이 μžˆμŠ΅λ‹ˆλ‹€. μ½˜μ†”μ˜ 경우 λ©”μ‹œμ§€μ— νƒ€μž„μŠ€νƒ¬ν”„λ₯Ό μ ‘λ‘μ–΄λ‘œ 뢙이고 색상을 μ§€μ •ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€. ν΄λΌμš°λ“œ 기반 λ‘œκΉ… μ„œλΉ„μŠ€μ˜ 경우 μ„œλΉ„μŠ€κ°€ 자체적으둜 μ œκ³΅ν•˜κΈ° λ•Œλ¬Έμ— νƒ€μž„μŠ€νƒ¬ν”„λ₯Ό μ›ν•˜μ§€ μ•ŠμœΌλ©° 색상도 μ›ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

이것이 우리의 지원을 λ°›μ•„ κ΅¬ν˜„ν•  μ€€λΉ„κ°€ 된 κΈ°λŠ₯μž…λ‹ˆκΉŒ?

이 κΈ°λŠ₯에 λŒ€ν•œ PR이 이미 μ „μ†‘λ˜μ—ˆμŠ΅λ‹ˆλ‹€: #427 및 #422

μ „μ†‘λ³„λ‘œ ν˜•μ‹μ„ κ΅¬μ„±ν•˜λŠ” 것이 이미 κ°€λŠ₯ν•˜μ§€λ§Œ README에 μ„€λͺ…λœ ν•΄λ‹Ή κΈ°λŠ₯을 보지 λͺ»ν–ˆμŠ΅λ‹ˆκΉŒ?

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

μ‹ κ²½ 쓰지 λ§ˆμ„Έμš”. 이것은 μ‹€μ œλ‘œ κ°€λŠ₯ν•˜μ§€λ§Œ λ¬Έμ„œμ—μ„œλŠ” 이 κΈ°λŠ₯에 λŒ€ν•œ 언급을 μ™„μ „νžˆ μƒλž΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'error.log', level: 'error',
      format: winston.format.simple(),
    }),
    new winston.transports.File({
      filename: 'combined.log', level: 'debug',
      format: winston.format.printf(info => `${new Date().toISOString(), ${info.message}`),
    }),
  ],
});

logger.error('prefixed by the timestamp only in `combined.log`');

λͺ¨λ“  5 λŒ“κΈ€

μ‹ κ²½ 쓰지 λ§ˆμ„Έμš”. 이것은 μ‹€μ œλ‘œ κ°€λŠ₯ν•˜μ§€λ§Œ λ¬Έμ„œμ—μ„œλŠ” 이 κΈ°λŠ₯에 λŒ€ν•œ 언급을 μ™„μ „νžˆ μƒλž΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'error.log', level: 'error',
      format: winston.format.simple(),
    }),
    new winston.transports.File({
      filename: 'combined.log', level: 'debug',
      format: winston.format.printf(info => `${new Date().toISOString(), ${info.message}`),
    }),
  ],
});

logger.error('prefixed by the timestamp only in `combined.log`');

ν™•μ‹€νžˆ λ¬Έμ„œμ— μΆ”κ°€ plz

@dandv κ·€ν•˜μ˜ 주석에 μžˆλŠ” printf μ½”λ“œλŠ”

κ·Έλž˜μ„œ 이 라인은...

format: winston.format.printf(info => `${new Date().toISOString(), ${info.message}`),

...λ‹«λŠ” μ€‘κ΄„ν˜Έκ°€ ν•„μš”ν•©λ‹ˆλ‹€.

format: winston.format.printf(info => `${new Date().toISOString()}, ${info.message}`),

μ‚¬μš©μž μ •μ˜ μ„œμ‹μ— λŒ€ν•œ μ½”λ“œμ™€ 지식에 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€! 맀우 감사!

신경쓰지 λ§ˆμ„Έμš”. 이것은 μ‹€μ œλ‘œ κ°€λŠ₯ν•˜μ§€λ§Œ λ¬Έμ„œμ—μ„œλŠ” 이 κΈ°λŠ₯에 λŒ€ν•œ 언급을 μ™„μ „νžˆ μƒλž΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'error.log', level: 'error',
      format: winston.format.simple(),
    }),
    new winston.transports.File({
      filename: 'combined.log', level: 'debug',
      format: winston.format.printf(info => `${new Date().toISOString(), ${info.message}`),
    }),
  ],
});

logger.error('prefixed by the timestamp only in `combined.log`');

@dandv 전솑 외뢀와 둜거 μž‘μ„± λ©”μ†Œλ“œ 내뢀에 λ‹€λ₯Έ ν˜•μ‹μ΄ 있으면 μ–΄λ–»κ²Œ

신경쓰지 λ§ˆμ„Έμš”. 이것은 μ‹€μ œλ‘œ κ°€λŠ₯ν•˜μ§€λ§Œ λ¬Έμ„œμ—μ„œλŠ” 이 κΈ°λŠ₯에 λŒ€ν•œ 언급을 μ™„μ „νžˆ μƒλž΅ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€.

const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'error.log', level: 'error',
      format: winston.format.simple(),
    }),
    new winston.transports.File({
      filename: 'combined.log', level: 'debug',
      format: winston.format.printf(info => `${new Date().toISOString(), ${info.message}`),
    }),
  ],
});

logger.error('prefixed by the timestamp only in `combined.log`');

@dandv 전솑 외뢀와 둜거 μž‘μ„± λ©”μ†Œλ“œ 내뢀에 λ‹€λ₯Έ ν˜•μ‹μ΄ 있으면 μ–΄λ–»κ²Œ

μ•ˆμ— ν•˜λ‚˜.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰