Winston: λ‘œκΉ…μ„ μœ„ν•΄ ν”„λ‘ νŠΈμ—”λ“œ(예: λΈŒλΌμš°μ €)μ—μ„œ winston을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

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

λ‘œκΉ…μ„ μœ„ν•΄ ν”„λ‘ νŠΈμ—”λ“œμ—μ„œ winston을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆκΉŒ? 더 λ‚˜μ€ ν”„λŸ°νŠΈ μ—”λ“œ λ‘œκΉ… κΈ°λŠ₯을 μœ„ν•΄ Winston을 μ‚¬μš©ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€. 이것이 κ°€λŠ₯ν•©λ‹ˆκΉŒ?

feature request

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

이봐, λ‚΄κ°€ νŒ¨ν‚€μ§€λ₯Όλ³΄κ³  λΈŒλΌμš°μ € 지원이 μ—†λ‹€λŠ” 것을 μ•Œμ•˜μ„ λ•Œ λ‚΄ 희망은 정말 λ†’μ•˜μŠ΅λ‹ˆλ‹€.
이것은 λΈŒλΌμš°μ €μ—μ„œ μ§‘μ—μ„œ μž¬λ°°ν•œ 것듀을 λŒ€μ²΄ν•˜κΈ° μœ„ν•΄ 정말 ꡉμž₯ν•  κ²ƒμž…λ‹ˆλ‹€.

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

λ‚˜λŠ” 그것을 μ‹œλ„ν•˜μ§€ μ•Šμ•˜μ§€λ§Œ 이것이 도움이 될 수 μžˆμŠ΅λ‹ˆλ‹€ https://github.com/farpoint/meteor-winston-client

이것은 λ‹€μŒκ³Ό 관련이 μžˆμŠ΅λ‹ˆλ‹€: https://github.com/flatiron/winston/issues/180

@joshacheson 링크에 404κ°€ μžˆμŠ΅λ‹ˆλ‹€!!

이 λ¬Έμ œμ— 진전이 μžˆμŠ΅λ‹ˆκΉŒ?

#582의 ν”Όλ“œλ°±μ— λ”°λ₯΄λ©΄ ν–₯ν›„ PR은 brfs 와 같은 shim을 μ‚¬μš©ν•˜λŠ” 것보닀 핡심 둜직과 전솑을 λΆ„λ¦¬ν•˜λŠ” 데 집쀑해야 ν•  것 κ°™μŠ΅λ‹ˆλ‹€. 이것은 큰 ꡬ쑰적 λ³€ν™”κ°€ 될 것이며 μŠ€νƒ€μΌκ³Ό μ ‘κ·Ό 방식에 λŒ€ν•œ 핡심 개발자의 지침이 거의 ν™•μ‹€ν•˜κ²Œ ν•„μš”ν•  κ²ƒμž…λ‹ˆλ‹€. ꢁ극적으둜 이λ₯Ό μœ μ§€ κ΄€λ¦¬ν•˜κ²Œ 될 것이기 λ•Œλ¬Έμž…λ‹ˆλ‹€.

쒋은 μ†Œμ‹μ€ μ½”λ“œκ°€ λŒ€λΆ€λΆ„ κΉ¨λ—ν•˜κ³  잘 κ΅¬μ„±λ˜μ–΄ μžˆμ§€λ§Œ μŠ€νƒ€μΌκ³Ό μ ‘κ·Ό 방식에 λŒ€ν•œ 핡심 개발자의 지침이 ν•„μš”ν•˜λ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€. @indexzero / @pose κ°€ λ‹Ήμ‹ μ˜ 생각을 κ³΅μœ ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

이 λ¬Έμ œμ— 진전이 μžˆμŠ΅λ‹ˆκΉŒ?

이봐, λ‚΄κ°€ νŒ¨ν‚€μ§€λ₯Όλ³΄κ³  λΈŒλΌμš°μ € 지원이 μ—†λ‹€λŠ” 것을 μ•Œμ•˜μ„ λ•Œ λ‚΄ 희망은 정말 λ†’μ•˜μŠ΅λ‹ˆλ‹€.
이것은 λΈŒλΌμš°μ €μ—μ„œ μ§‘μ—μ„œ μž¬λ°°ν•œ 것듀을 λŒ€μ²΄ν•˜κΈ° μœ„ν•΄ 정말 ꡉμž₯ν•  κ²ƒμž…λ‹ˆλ‹€.

+1

κ°™κ±°λ‚˜ λ‚˜. μ•žλ©΄κ³Ό 뒷면에 λŒ€ν•΄ λ™μΌν•œ λ‘œκΉ… 라이브러리λ₯Ό μ‚¬μš©ν•˜λŠ” 것도 도움이 λ©λ‹ˆλ‹€.

λ‚˜λŠ” 이것을 λΈŒλΌμš°μ§•ν•˜κ³  μžˆμ—ˆκ³  http 전솑이 μžˆμŒμ—λ„ λΆˆκ΅¬ν•˜κ³  λΈŒλΌμš°μ €/기타에 λŒ€ν•œ ν‘œμ€€ ν΄λΌμ΄μ–ΈνŠΈλ‘œ 보이지 μ•ŠλŠ” 것이 λΆ€λ„λŸ¬μš΄ 것 κ°™μŠ΅λ‹ˆλ‹€.

bunyan을 μ‚¬μš©ν•΄μ•Όν•œλ‹€λŠ” 것이 μŠ¬ν”„λ‹€.

이것에 λŒ€ν•œ μ†Œμ‹μ΄ μžˆμŠ΅λ‹ˆκΉŒ?

μ •λ§λ‘œ μ‚¬μš©ν•˜κ³  μ‹Άλ‹€λ©΄ λ‹€μŒκ³Ό 같이 μ‚¬μš©μž 지정 전솑을 μž‘μ„±ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

const Transport = require('winston-transport');

export default class BrowserConsole extends Transport {
  constructor(opts) {
    super(opts);

    this.name = 'BrowserConsole';
    this.levels = {
        error: 0,
        warn: 1,
        info: 2,
        debug: 4,
    };

    this.methods = {
        error: 'error',
        warn: 'warn',
        info: 'info',
        debug: 'log',
    };

    this.level = opts.level && this.levels.hasOwnProperty(opts.level)
                  ? opts.level : 'info';
  }

  log(method, message) {
    setImmediate(() => {
      this.emit('logged', method);
    });

    const val = this.levels[method];
    const mappedMethod = this.methods[method];

    if (val <= this.levels[this.level]) {
      // eslint-disable-next-line
      console[mappedMethod](message);
    }
  }
}

그런 λ‹€μŒ λ‹€μŒκ³Ό 같이 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

import BrowserConsole from './BrowserConsole';

const { createLogger, transports } = require('winston');

const log = createLogger({
  level: 'info',
});

if (process.env.NODE_ENV !== 'production') {
  log.add(new BrowserConsole({
    level: 'info',
  }));
}

이 전솑을 μ‚¬μš©ν•˜λ©΄ λ ˆκ±°μ‹œ μ½”λ“œλ‘œ κ°„μ£Όλ˜κΈ° λ•Œλ¬Έμ— μ“Έλͺ¨μ—†λŠ” κ²½κ³ κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€. λ‹€λ₯Έ μ½˜μ†” 방법( table , dir , trace , ...)을 μ‚¬μš©ν•  수 μžˆλŠ” κ°€λŠ₯성을 μΆ”κ°€ν•˜λŠ” 것도 μ•„λ¦„λ‹΅μ§€λ§Œ κ°„λ‹¨ν•˜κ²Œ ν•˜κΈ° μœ„ν•΄ κ·ΈλŒ€λ‘œμž…λ‹ˆλ‹€.

@chrisvoo κ°μ‚¬ν•©λ‹ˆλ‹€. 이 μ†”λ£¨μ…˜μ„ μ‹œλ„ν–ˆμ§€λ§Œ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

ReferenceError: Buffer is not defined
    replacer 
    json.js/module.exports< 
    _transform 
    _stream_transform.js/Transform.prototype._read
    _stream_transform.js/Transform.prototype._write
    doWrite
    writeOrBuffer
    _stream_writable.js/Writable.prototype.write
    log

@dmitry-salnikov 잘 λͺ¨λ₯΄κ² μŠ΅λ‹ˆλ‹€. 이 μ½”λ“œκ°€ μŠ€νŠΈλ¦Όμ„ μ‚¬μš©ν•˜λŠ” 이유λ₯Ό 이해할 수 μ—†μŠ΅λ‹ˆλ‹€. λ‚΄ μ‚¬μš© 사둀가 λ„ˆλ¬΄ λ‹¨μˆœν–ˆμ„ μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€. μ–΄λ–»κ²Œ μ‚¬μš©ν•˜κ³  μžˆλŠ”μ§€ κ³΅μœ ν•΄ λ³΄μ„Έμš”.

@chrisvoo BrowserConsole κ΅¬ν˜„μ„ λ³„λ„μ˜ νŒŒμΌμ— λ³΅μ‚¬ν•˜μ—¬ 뢙여넣은 λ‹€μŒ λ‹€λ₯Έ νŒŒμΌμ— μ½”λ“œμ˜ 두 번째 뢀뢄을 λΆ™μ—¬λ„£κ³  BrowserConsole 전솑 μ½”λ“œ(μŠ€λ‹ˆνŽ«μ˜ λ§ˆμ§€λ§‰ 쀄)λ₯Ό μΆ”κ°€ν•œ ν›„ λ‹¨μˆœνžˆ μ‹œλ„ν–ˆμŠ΅λ‹ˆλ‹€:

log.info('hello world');

그런 λ‹€μŒ 였λ₯˜κ°€ λ°œμƒν•˜μ—¬ λ‹€μŒμ„ μ‹œλ„ν–ˆμŠ΅λ‹ˆλ‹€.

log.log('info, 'hello world');

두 호좜 λͺ¨λ‘ λ™μΌν•œ 였λ₯˜λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.

λΈŒλΌμš°μ €μ—μ„œ Nodeλ₯Ό μ‚¬μš©ν•  수 μžˆλŠ” ν™˜κ²½μ€ Meteor.js v1.6(Node 8.8.1)μž…λ‹ˆλ‹€. λ˜ν•œ μ½”λ“œ μŠ€λ‹ˆνŽ«μ˜ ν•œ 쀄도 μˆ˜μ •ν•˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

BTW: μ–Όλ§ˆ 전에 winston을 μ‚¬μš©ν•˜κΈ° μ‹œμž‘ν–ˆκΈ° λ•Œλ¬Έμ— 잘λͺ»λœ 일을 ν•˜κ³  μžˆμ„ 수 μžˆμŠ΅λ‹ˆλ‹€.

@dmitry-salnikov μ–΄λ–€ μ’…λ₯˜μ˜ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆκΉŒ? "μ •λ³΄λŠ” κΈ°λŠ₯이 μ•„λ‹™λ‹ˆλ‹€"와 같이? μ–΄λ–€ μ΄μœ μ—μ„œμΈμ§€ μˆ˜μž…μ΄ 쒋지 μ•ŠμŠ΅λ‹ˆλ‹€.

@chrisvoo λ΄μ£Όμ„Έμš”:
screenshot 2017-11-08 20 35 31

BrowserConsole.js 의 λ‚΄μš©(파일 νŠΈλ¦¬μ—μ„œ λ³Ό 수 있음)은 μŠ€λ‹ˆνŽ«μ—μ„œμ™€ λ™μΌν•©λ‹ˆλ‹€.

그리고 λ‚˜λŠ” λ‹Ήμ‹ μ˜ μ˜κ²¬μ— λ™μ˜ν•©λ‹ˆλ‹€. κ°€μ Έμ˜€κΈ°μ— λ¬Έμ œκ°€ μžˆλŠ” 것 κ°™μ§€λ§Œ 이유λ₯Ό μ•Œ 수 μ—†μŠ΅λ‹ˆλ‹€.

λ‹Ήμ‹ μ˜ μœˆμŠ€ν„΄ 버전은 λ¬΄μ—‡μž…λ‹ˆκΉŒ? λ‚΄ 것은:

"winston": "^3.0.0-rc1",
"winston-transport": "^3.0.1"

사싀 같은

$ npm ls | grep winston
β”œβ”€β”¬ [email protected]
β”‚ └── [email protected]
└── [email protected]
$ cat package.json | grep winston
    "winston": "^3.0.0-rc1",
    "winston-transport": "^3.0.1"

이 문제λ₯Ό ν•΄κ²°ν•˜κΈ° μœ„ν•΄ λ‹€λ₯Έ ν…ŒμŠ€νŠΈλ₯Ό ν–ˆμŠ΅λ‹ˆλ‹€.

import winston from 'winston';
import BrowserConsole from '/imports/BrowserConsole.js';

const format = winston.format;
// next line throws exception, see below
const { combine, timestamp, label, printf, colorize, prettyPrint } = format;

const logger = winston.createLogger({
...

λ‹€μŒ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€: Cannot find module './combine'

λ‹€μŒμ€ μŠ€νƒ 좔적 및 κ΄€λ ¨ μ½”λ“œ(λΈŒλΌμš°μ € μŠ€ν¬λ¦°μƒ·)μž…λ‹ˆλ‹€.
screenshot 2017-11-10 04 01 04

λ­”κ°€ μˆ˜μž…μ΄ μ•ˆ 쒋은 것 κ°™μŠ΅λ‹ˆλ‹€. @chrisvoo μ’€ λ΄μ£Όμ‹œκ² μ–΄μš” ?

Winston 3.0.0μ—μ„œ 전솑은 μŠ€νŠΈλ¦Όμž…λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ browserify-streamμ—μ„œ readableStream instanceof Stream λŠ” 사싀이 μ•„λ‹™λ‹ˆλ‹€. 이둜 인해 Winston은 전솑을 λ ˆκ±°μ‹œ 래퍼둜 λž˜ν•‘ν•˜κ³  κ²½κ³ λ₯Ό λ‚΄λ³΄λƒ…λ‹ˆλ‹€. 슀트리밍 감지에 λ‹€λ₯Έ 방법을 μ‚¬μš©ν•˜κΈ° μœ„ν•΄ PR을 λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€. #1145

@Jasu 사싀 λ‚˜λ„ 이것을 μ•Œμ•„μ°¨λ Έκ³ , 이에 κ΄€ν•΄ 이전에 winston-transport 에 문제λ₯Ό μ œμΆœν–ˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ μ½˜μ†” 전솑이 λ™ν˜•μ΄ λ˜λ„λ‘ 곧 pull μš”μ²­μ„ μ œμΆœν•  κ²ƒμž…λ‹ˆλ‹€.

λ¬΄μ‹œ: [혼자 κ΅¬λ…ν•˜λ©΄ ν•  수 μ—†κΈ° λ•Œλ¬Έμ—](https://github.com/isaacs/github/issues/283) λ‚˜μ€‘μ— 이 문제λ₯Ό μ‰½κ²Œ 찾을 수 μžˆλ„λ‘ 여기에 λŒ“κΈ€μ„ λ‚¨κΉλ‹ˆλ‹€.

Error: Cannot find module './combine' 같은 문제λ₯Ό λ§Œλ‚¬μŠ΅λ‹ˆλ‹€.

+1

@chrisvoo : μ•„λž˜λŠ” κ·€ν•˜μ˜ μŠ€λ‹ˆνŽ«μ„ μ‹€ν–‰ν•˜λ €κ³  ν•  λ•Œ λ°œμƒν•˜λŠ” 였λ₯˜μž…λ‹ˆλ‹€(winston 및 winston-transportλŠ” 3+ 버전에 있음).
winston-transport/index.js의 였λ₯˜
λͺ¨λ“ˆμ„ 찾을 수 μ—†μŒ: 였λ₯˜: node_modules/winston-transport의 '슀트림'을 확인할 수 μ—†μŠ΅λ‹ˆλ‹€.

PR #1145(2017λ…„ 11μ›” μ˜€ν”ˆ)κ°€ μ˜¬ν•΄ 합병될 κ°€λŠ₯성이 μžˆμŠ΅λ‹ˆκΉŒ? :λˆˆμ§“:

@dmitry-salnikov #1145κ°€ λ§ˆμŠ€ν„°μ— λ³‘ν•©λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 아직 λ¦΄λ¦¬μŠ€μ—λŠ” μ—†μŠ΅λ‹ˆλ‹€.

λ‹«κΈ° λ‹«κΈ° λ‹«κΈ° λ‹«κΈ°

지원 μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€ λ‚˜μ€‘μ— 감자

적어도 5년은 결싀을 λ§ΊλŠ”λ‹€. Winston은 μ—¬μ „νžˆ ​​JavaScript IMOλ₯Ό μœ„ν•œ 졜고의 λ‘œκΉ… μ‹œμŠ€ν…œμž…λ‹ˆλ‹€.

감사 ν•΄μš”!

이것은 λΈŒλΌμš°μ € 지원을 ν™•μΈν•˜λŠ” ν…ŒμŠ€νŠΈκ°€ ν…ŒμŠ€νŠΈ μŠ€μœ„νŠΈμ— μžˆμ„ λ•ŒκΉŒμ§€ μ—΄λ € μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ babel 및 webpack μ£Όλ³€μ˜ λŒ€λΆ€λΆ„μ˜ λͺ¨μ„œλ¦¬ 및 λͺ¨μ„œλ¦¬ μΌ€μ΄μŠ€κ°€ ν•΄κ²°λœ 것 κ°™μŠ΅λ‹ˆλ‹€.

μ—¬κΈ°μ—μ„œ μš°λ¦¬λŠ” winston을 μ‚¬λž‘ ν•˜κ³  ν΄λΌμ΄μ–ΈνŠΈ μΈ‘ λ‘œκΉ… 미듀웨어가 ν•„μš”ν•©λ‹ˆλ‹€.

λΈŒλΌμš°μ €κ°€ κ΅¬ν˜„λœ 지 μ‹œκ°„μ΄ 쑰금 μ§€λ‚¬λŠ”λ° μ§€κΈˆλΆ€ν„° μ‚¬μš©ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€.

λ‹¨μœ„ ν…ŒμŠ€νŠΈ 및 전체 λΈŒλΌμš°μ € 적용 λ²”μœ„λ₯Ό 기닀리기 전에 λΈŒλΌμš°μ € 지원에 λŒ€ν•œ λŒ€λž΅μ μΈ 아이디어가 μžˆμŠ΅λ‹ˆκΉŒ?

λ‚΄ ν”„λ‘œμ νŠΈμ— winston을 κ°€μ Έμ˜€λ €κ³  μ‹œλ„ν–ˆμ§€λ§Œ λ‹€μŒ λ©”μ‹œμ§€μ™€ ν•¨κ»˜ μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.
./\~/winston/lib/winston/tail-file.js의 였λ₯˜
λͺ¨λ“ˆμ„ 찾을 수 μ—†μŒ: 였λ₯˜: '/Users/me/workspaces/app/node_modules/winston/lib/winston'μ—μ„œ 'fs'λ₯Ό 확인할 수 μ—†μŠ΅λ‹ˆλ‹€.
@ ./\~/winston/lib/winston/tail-file.js 10:11-24
@ ./\~/winston/lib/winston/transports/file.js
@ ./\~/winston/lib/winston/transports/index.js
@ ./\~/winston/lib/winston.js
@ ./src/app/app.module.ts
@ ./src/main.ts

winston의 index.js import 'fs'κ°€ ν•„μš”ν•œ '.file'을 κ°€μ Έμ˜€λŠ” Transports.

이 μ‹ μ„ ν•œ 지μ˜₯μ—μ„œ μ–΄λ–»κ²Œ ꡬ독을 μ·¨μ†Œν•©λ‹ˆκΉŒ

  • λ‚¨μž 이름

2018λ…„ 8μ›” 7일 ν™”μš”μΌ μ˜€ν›„ 2μ‹œ 19뢄에 Kfir Erez [email protected] μ—μ„œ λ‹€μŒκ³Ό 같이 μΌμŠ΅λ‹ˆλ‹€.

λ‚΄ ν”„λ‘œμ νŠΈμ— winston을 κ°€μ Έμ˜€λ €κ³  μ‹œλ„ν–ˆμ§€λ§Œ λ‹€μŒμœΌλ‘œ μ‹€νŒ¨ν–ˆμŠ΅λ‹ˆλ‹€.
메세지:
.//winston/lib/winston/tail-file.js의 였λ₯˜
λͺ¨λ“ˆμ„ 찾을 수 μ—†μŒ: 였λ₯˜: 'fs'λ₯Ό 확인할 수 μ—†μŠ΅λ‹ˆλ‹€.
'/Users/me/workspaces/app/node_modules/winston/lib/winston'
@ .//winston/lib/winston/tail-file.js 10:11-24
@ .//winston/lib/winston/transports/file.js
@ .//winston/lib/winston/transports/index.js
@ ./~/winston/lib/winston.js
@ ./src/app/app.module.ts
@ ./src/main.ts

winston의 index.js import '.file'을 κ°€μ Έμ˜€λŠ” TransportsλŠ” λ‹€μŒμ΄ ν•„μš”ν•©λ‹ˆλ‹€.
'FS'.

β€”
당신이 λŒ“κΈ€μ„ λ‹¬μ•˜κΈ° λ•Œλ¬Έμ— 이것을 λ°›λŠ” κ²ƒμž…λ‹ˆλ‹€.
이 이메일에 직접 λ‹΅μž₯ν•˜κ³  GitHubμ—μ„œ ν™•μΈν•˜μ„Έμš”.
https://github.com/winstonjs/winston/issues/287#issuecomment-410946148 ,
λ˜λŠ” μŠ€λ ˆλ“œ μŒμ†Œκ±°
https://github.com/notifications/unsubscribe-auth/AE3lcdZ3aQKEVYvYB2TXjh0dnQ1FaBS2ks5uOTFhgaJpZM4A2vjK
.

@mjcd 당신은 여기에 μ˜μ›νžˆ κ°‡ν˜€ μžˆμŠ΅λ‹ˆλ‹€ πŸ˜† (j/k, μ΄λ©”μΌμ˜ 링크λ₯Ό μ‚¬μš©ν•˜κ±°λ‚˜ ghλ₯Ό 톡해 ꡬ독을 μ·¨μ†Œν•  수 μžˆμŠ΅λ‹ˆλ‹€)

@KErezκ°€ webpack 을 μ‚¬μš©ν•˜λŠ” 것과 λ™μΌν•œ 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

이λ₯Ό ν•΄κ²°ν•˜λŠ” 일반적인 방법은 μ›ΉνŒ© ꡬ성에 node: { fs: 'empty' } λ₯Ό λ„£λŠ” κ²ƒμž…λ‹ˆλ‹€. 그리고 λΆ„λͺ…νžˆ λΈŒλΌμš°μ €μ—μ„œ File 전솑을 μ‚¬μš©ν•˜λ €κ³  ν•˜λ©΄ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μΆ”κ°€ ꡬ성 μ„€μ • 없이 webpackμ—μ„œ winston λ²ˆλ“€μ„ λ§Œλ“€ 수 μžˆλ‹€λ©΄ μ’‹κ² μ§€λ§Œ κ°€λŠ₯ν•˜λ‹€λ©΄ idkμž…λ‹ˆλ‹€. λ‹€λ₯Έ 인기 μžˆλŠ” νŒ¨ν‚€μ§€λ„ 같은 것을 ꢌμž₯ν•˜μ§€λ§Œ https://github.com/pugjs/pug-loader/issues/8#issuecomment -328331541μ—μ„œλŠ” winston의 package.jsonμ—μ„œ 이 문제λ₯Ό μˆ˜μ •ν•  수 μžˆλ‹€κ³  μ œμ•ˆν•©λ‹ˆλ‹€. λˆ„κ΅°κ°€ 그것을 μ‹œλ„ν•˜κ³  ν•΄λ‹Ή 였λ₯˜κ°€ ν•΄κ²°λ˜λ©΄ PR을 μ—΄κ³  μ‹ΆμŠ΅λ‹ˆκΉŒ(예: μ•±μ˜ webpack ꡬ성을 λ³€κ²½ν•˜μ§€ μ•Šκ³  winston의 package.json만 λ³€κ²½)?

λ‚˜ setImmediate둜 인해 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€... @chrisvoo κ°€ μ„±κ³΅ν•˜λŠ” κ²ƒμ²˜λŸΌ λ³΄μ΄λŠ” 이유λ₯Ό 이해할 수 μ—†μŠ΅λ‹ˆλ‹€. μ•„λ§ˆλ„ κ·Έκ°€ 폴리필을 μ‚¬μš©ν•˜κΈ° λ•Œλ¬ΈμΌκΉŒμš”?

λ‚΄ κ΄€λ ¨ 문제: https://github.com/winstonjs/winston/issues/1489

@chrisvoo μ½”λ“œ(thx so much)λ₯Ό 기반으둜 νŒ¨ν‚€μ§€λ₯Ό λ§Œλ“€μ—ˆμŠ΅λ‹ˆλ‹€.
https://www.npmjs.com/package/winston-transport-browserconsole.

λ˜ν•œ κΈ°λ³Έ winston μ½˜μ†” 좜λ ₯κ³Ό 비ꡐ할 수 μžˆλ„λ‘ μ•½κ°„μ˜ μƒ˜ν”Œμ΄ μžˆμŠ΅λ‹ˆλ‹€.

이λ₯Ό ν•΄κ²°ν•˜λŠ” 일반적인 방법은 webpack ꡬ성에 node: { fs: 'empty' }λ₯Ό λ„£λŠ” κ²ƒμž…λ‹ˆλ‹€.

μ›ΉνŒ© ꡬ성을 λ³€κ²½ν•  ν•„μš” 없이 μ›ΉνŒ© λΈŒλΌμš°μ € λ²ˆλ“€μ„ 지원할 κ³„νšμ΄ μžˆμŠ΅λ‹ˆκΉŒ?

μΆ”κ°€ ꡬ성 μ„€μ • 없이 webpackμ—μ„œ winston λ²ˆλ“€μ„ λ§Œλ“€ 수 μžˆλ‹€λ©΄ μ’‹κ² μ§€λ§Œ κ°€λŠ₯ν•˜λ‹€λ©΄ idkμž…λ‹ˆλ‹€. λ‹€λ₯Έ 인기 μžˆλŠ” νŒ¨ν‚€μ§€λ„ 같은 것을 ꢌμž₯ν•˜μ§€λ§Œ pugjs/pug-loader#8(주석) 은 winston의 package.jsonμ—μ„œ 이 문제λ₯Ό μˆ˜μ •ν•  수 μžˆλ‹€κ³  μ œμ•ˆν•©λ‹ˆλ‹€. λˆ„κ΅°κ°€ 그것을 μ‹œλ„ν•˜κ³  ν•΄λ‹Ή 였λ₯˜κ°€ ν•΄κ²°λ˜λ©΄ PR을 μ—΄κ³  μ‹ΆμŠ΅λ‹ˆκΉŒ(예: μ•±μ˜ webpack ꡬ성을 λ³€κ²½ν•˜μ§€ μ•Šκ³  winston의 package.json만 λ³€κ²½)?

@DABH λΆˆν–‰νžˆλ„, λ‚˜λŠ” 그것이 κ·Έλ ‡κ²Œ κ°„λ‹¨ν•˜λ‹€κ³  μƒκ°ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λΈŒλΌμš°μ € ν•„λ“œλ₯Ό μ‚¬μš©ν•˜μ—¬ λ‹€λ₯Έ μ§„μž…μ μ„ μ •μ˜ν•©λ‹ˆλ‹€. λ‹€λ₯Έ μ§„μž…μ μ„ μ •μ˜ν•˜κ±°λ‚˜ ν•΄λ‹Ή 티켓에 μ„€λͺ…λœ λŒ€λ‘œ νŠΉμ • λͺ¨λ“ˆμ„ κ΅μ²΄ν•˜λŠ” 데 μ‚¬μš©ν•  수 μžˆλ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€. λ‘˜ λ‹€ μ•„λ‹™λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ 이미 μžμ‹ μ˜ λΈŒλΌμš°μ € 버전을 κ΅¬μΆ•ν•˜κ³  있기 λ•Œλ¬Έμ— ν•΄λ‹Ή λ²„μ „μ—μ„œ μ œκ±°ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이번 주말에 κΈ°νšŒκ°€ λœλ‹€λ©΄ κΌ­ κ°€λ΄μ•Όκ² μŠ΅λ‹ˆλ‹€.

이에 λŒ€ν•œ 진전이 μžˆμŠ΅λ‹ˆκΉŒ? 6년이 지났고 내일이면 2020년이 λ©λ‹ˆλ‹€ :-)

μ•„λ§ˆλ„ 해결책은 winston을 λ‹€μ‹œ νŒ¨ν‚€μ§•ν•˜μ—¬ μš΄μ†‘μ—…μžκ°€ μžμ‹ μ˜ λͺ¨λ“ˆμ΄ λ˜λ„λ‘ ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. 더 λ‚˜μ€ μ†”λ£¨μ…˜μ²˜λŸΌ λ“€λ¦½λ‹ˆλ‹€.

κ°λ„μ—μ„œ Winston을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆκΉŒ? μ–΄λ–»κ²Œ ?

@ArpithaGMGowda λŠ” ν‘œμ€€ 각도 CLIκ°€ μ•„λ‹™λ‹ˆλ‹€.

κ·Έλ ‡λ‹€λ©΄ μš°λ¦¬λŠ” Angular 7에 무엇을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆκΉŒ ??
μ–΄λ–€ 아이디어라도

μ§€λ‚œ ν”„λ‘œμ νŠΈμ—μ„œ js-loggerλ₯Ό μ‚¬μš©ν–ˆλŠ”λ° 맀우 잘 μž‘λ™ν–ˆμœΌλ©° μž‘λ…„μ— ν™œλ™μ΄ λ§Žμ§€ μ•Šμ€ κ²ƒμ²˜λŸΌ λ³΄μ΄μ§€λ§Œ μ—˜ν¬μ—κ²Œ 둜그λ₯Ό 보낼 수 μžˆμŠ΅λ‹ˆλ‹€. https://github.com/jonnyreeves/js-logger
track.js와 같이 당신을 μœ„ν•΄ μž‘λ™ν•  μˆ˜λ„ μžˆλŠ” 쒋은 λ‘œκΉ… μ„œλΉ„μŠ€κ°€ μžˆμŠ΅λ‹ˆλ‹€.

이 라이브러리λ₯Ό λ…Έλ“œμ— λŒ€ν•œ 쒅속성을 μ œκ±°ν•˜λŠ” μƒˆ ꡬ쑰둜 λ‹€μ‹œ μž‘μ„±ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒμ£Όμ— 끝내야지

μ½”λ“œ 기반 Winston의 λ¬Έμ œλŠ” 핡심 κΈ°λŠ₯을 μ†μƒμ‹œν‚€μ§€ μ•Šκ³  ν˜„λŒ€ν™”ν•΄μ•Ό ν•©λ‹ˆλ‹€.

전솑 계측은 자체 ν•˜μœ„ λͺ°λ“œλ‘œ λΆ„ν• ν•΄μ•Ό ν•˜λ©°, κ·Έ λŒ€κ°€λ‘œ νŒ€μ—μ„œ μ›ν•˜μ§€ μ•ŠλŠ” λ³€κ²½ 사항이 λ°œμƒν•  κ²ƒμž…λ‹ˆλ‹€. νŒ€μ΄ μƒˆλ‘œμš΄ μƒνƒœκ³„λ₯Ό 기꺼이 μ±„νƒν•˜μ§€ μ•ŠλŠ” ν•œ. 수리 쀑인 PR이 μŠΉμΈλ μ§€ 확신이 μ„œμ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

NGX-Logger " https://www.npmjs.com/package/ngx-logger "λ₯Ό μ‚¬μš©ν•΄ λ³΄μ…¨μŠ΅λ‹ˆκΉŒ?

@ArpithaGMGowda λ‚΄ 생각에 λ‚˜λŠ” 당신을 μ„ΈνŠΈ ν”„λ ˆμž„μ›Œν¬μ— λ¬ΆλŠ” μ½”λ“œ 베이슀λ₯Ό μž‘μ„±ν•˜λŠ” 것을 μ’‹μ•„ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. μ½”λ“œλŠ” UIμ—μ„œ μ„œλΉ„μŠ€ ν˜ΈμΆœκΉŒμ§€ κ°€λŠ₯ν•œ ν•œ λΆˆκ°€μ§€λ‘ μ μ΄μ–΄μ•Ό ν•©λ‹ˆλ‹€. λ‚˜λŠ” λ˜ν•œ ν†΅μΌλœ λ©”μ»€λ‹ˆμ¦˜μ˜ 아이디어λ₯Ό μ’‹μ•„ν•©λ‹ˆλ‹€. λ°±μ—”λ“œλ₯Ό μœ„ν•œ ν•œ 가지 방법과 ν”„λ‘ νŠΈμ—”λ“œλ₯Ό μœ„ν•œ λ‹€λ₯Έ 방법이 μžˆλŠ” 이유

이 라이브러리λ₯Ό λ…Έλ“œμ— λŒ€ν•œ 쒅속성을 μ œκ±°ν•˜λŠ” μƒˆ ꡬ쑰둜 λ‹€μ‹œ μž‘μ„±ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒμ£Όμ— 끝내야지

@Jordan-Hall μ‘°λ§Œκ°„ rc λ₯Ό κ°–κ²Œ 될지 κΆκΈˆν•©λ‹ˆλ‹€(κ°μ‚¬ν•©λ‹ˆλ‹€).
winston을 μ‚¬μš©ν•˜λŠ” ν”„λ‘œμ νŠΈ/libλ₯Ό μ‚¬μš©ν•  λ•Œ μ€‘λ‹¨λ˜μ§€ μ•Šλ„λ‘ 타사 μ›ΉνŒ©μ„ μˆ˜μ •ν•΄μ•Ό ν•˜λŠ” 것은 어렀움을 κ²ͺκ³  μžˆμŠ΅λ‹ˆλ‹€.

@MarcoMedrano 이둠적으둜 μƒˆλ‘œμš΄ λΌμ΄λΈŒλŸ¬λ¦¬κ°€ μ™„μ„±λ˜λŠ” 근본적인 λ³€ν™”μž…λ‹ˆλ‹€.

@pose μ½”μ–΄ νŒ¨ν‚€μ§€μ—μ„œ 전솑 계측을 λΆ„λ¦¬ν•˜λŠ” 것에 λŒ€ν•œ κ·€ν•˜μ˜ κ²¬ν•΄λŠ” λ¬΄μ—‡μž…λ‹ˆκΉŒ? λ‚˜λŠ” Winston을 μ’‹μ•„ν•˜μ§€λ§Œ μƒνƒœκ³„λŠ” λ³€ν™”κ°€ ν•„μš”ν•©λ‹ˆλ‹€

이 글을 μž‘μ„±ν•˜λŠ” 데 μ‹œκ°„μ΄ κ±Έλ Έμ§€λ§Œ 이에 λŒ€ν•œ λ‹€μ†Œ 합리적인 해결책을 생각해 λƒˆμŠ΅λ‹ˆλ‹€.
λ‹€μŒμ„ μ‚¬μš©ν•˜λ©΄ λΈŒλΌμš°μ €μ—μ„œ 였λ₯˜, κ²½κ³  및 정보 μˆ˜μ€€( μ‚¬μš©μž μ •μ˜ 접두사 포함)을 μ‚¬μš©ν•  수 있으며 λ‹€μŒκ³Ό 같이 ν‘œμ‹œλ©λ‹ˆλ‹€.
gHLo47GZ0bvMAsiqhxRfSV3TIWyXn9NO

이것이 μž‘λ™ν•˜λ €λ©΄ winston , logform 및 winston-transport λ₯Ό μ’…μ†μ„±μœΌλ‘œ μ„€μΉ˜ν•΄μ•Ό ν•©λ‹ˆλ‹€.

이것을 κ΅¬ν˜„ν•˜λŠ” 데 ν•„μš”ν•œ μ½”λ“œλŠ” λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.
이것은 typescript 둜 μž‘μ„±λ˜μ—ˆμœΌλ©° μžλ°” 슀크립트 μ˜ˆμ œλŠ” μ•„λž˜μ™€ κ°™μŠ΅λ‹ˆλ‹€.

import * as winston from 'winston';
import {TransformableInfo} from 'logform';
import TransportStream = require('winston-transport');

// enumeration to assign color values to
enum LevelColors {
  INFO = 'darkturquoise',
  WARN = 'khaki',
  ERROR = 'tomato',
}

// type levels used for setting color and shutting typescript up
type Levels = 'INFO' | 'WARN' | 'ERROR';

const defaultColor = 'color: inherit';

//! Overriding winston console transporter
class Console extends TransportStream {
  constructor(options = {}) {
    super(options);

    this.setMaxListeners(30);
  }

  log(info: TransformableInfo, next: () => void) {
    // styles a console log statement accordingly to the log level
    // log level colors are taken from levelcolors enum
    console.log(
      `%c[%c${info.level.toUpperCase()}%c]:`,
      defaultColor,
      `color: ${LevelColors[info.level.toUpperCase() as Levels]};`,
      defaultColor,
      // message will be included after stylings
      // through this objects and arrays will be expandable
      info.message
    );

    // must call the next function here
    // or otherwise you'll only be able to send one message
    next();
  }
}

// creating silent loggers with according levels
// silent by default to be automatically deactivated
// in production mode
export const logger = winston.createLogger({
  transports: [
    new Console({
      silent: true,
      level: 'info',
    }),
  ],
});

// don't log anything in production mode
// probably should go further and return non
// working logger function to reduce
// execution time and improve speed results
// on application
if (process.env.NODE_ENV !== 'production') {
  logger.transports.forEach(transport => (transport.silent = false));
}

그리고 여기에 μžλ°” 슀크립트 μ˜ˆμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€

import * as winston from 'winston';

import {TransformableInfo} from 'logform';
import TransportStream = require('winston-transport');

// enumeration to assign color values to
const LevelColors = {
  INFO: 'darkturquoise',
  WARN: 'khaki',
  ERROR: 'tomato',
}

const defaultColor = 'color: inherit';

//! Overriding winston console transporter
class Console extends TransportStream {
  constructor(options = {}) {
    super(options);

    this.setMaxListeners(30);
  }

  log(info, next) {
    // styles a console log statement accordingly to the log level
    // log level colors are taken from levelcolors enum
    console.log(
      `%c[%c${info.level.toUpperCase()}%c]:`,
      defaultColor,
      `color: ${LevelColors[info.level.toUpperCase()]};`,
      defaultColor,
      // message will be included after stylings
      // through this objects and arrays will be expandable
      info.message
    );

    // must call the next function here
    // or otherwise you'll only be able to send one message
    next();
  }
}

// creating silent loggers with according levels
// silent by default to be automatically deactivated
// in production mode
export const logger = winston.createLogger({
  transports: [
    new Console({
      silent: true,
      level: 'info',
    }),
  ],
});

// don't log anything in production mode
// probably should go further and return non
// working logger function to reduce
// execution time and improve speed results
// on application
if (process.env.NODE_ENV !== 'production') {
  logger.transports.forEach(transport => (transport.silent = false));
}

LevelColors μ—΄κ±°ν˜•μ—μ„œ 색상을 λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆλ‹€. μ„œμ‹μ„ λ³€κ²½ν•˜λ €λ©΄ 29행을 μ‚΄νŽ΄λ³΄μ„Έμš”.

디버그 μˆ˜μ€€μ— λŒ€ν•œ 지원을 μΆ”κ°€ν•©λ‹ˆλ‹€. μ½˜μ†” μ˜΅μ…˜μ—μ„œ level λ₯Ό 'debug' μ„€μ •ν•©λ‹ˆλ‹€.
λ˜ν•œ λͺ¨λ“  ν‘œμ€€ winston μˆ˜μ€€μ— λŒ€ν•œ 지원을 μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 즉, 비상, κ²½κ³ , 치λͺ…타, 였λ₯˜, κ²½κ³ , 정보 및 디버그λ₯Ό μ˜λ―Έν•©λ‹ˆλ‹€. 이것듀도 μ‚¬μš©ν•˜λ €λ©΄ 이 객체λ₯Ό createLogger 루트의 levels ꡬ성에 μΆ”κ°€ν•΄μ•Ό ν•©λ‹ˆλ‹€.

{
   emerg: 0,
   alert: 1,
   crit: 2,
   error: 3,
   warn: 4,
   info: 5,
   debug: 6,
}

그런 λ‹€μŒ LevelColors μ—΄κ±°ν˜•μ— 색상 값을 μΆ”κ°€ν•©λ‹ˆλ‹€.

이 문제의 μƒνƒœλ₯Ό λͺ…ν™•ν•˜κ²Œ νŒŒμ•…ν•˜κΈ° μœ„ν•΄ μ• μ“°κ³  μžˆμŠ΅λ‹ˆλ‹€. λ‚΄ React μ•±μ—μ„œ Winston을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?

μ €λŠ” μ‹€μ œλ‘œ λΈŒλΌμš°μ € μ½˜μ†”μ— λ‘œκ·ΈμΈν•˜λŠ” 데 그닀지 관심이 μ—†μŠ΅λ‹ˆλ‹€. 그리고 μ†”μ§νžˆ λ§ν•΄μ„œ λ‚΄μž₯ console κ°€ 같은 λͺ©μ μ„ μ œκ³΅ν•  λ•Œ winston console transporter λ₯Ό μž¬μ •μ˜ν•˜λŠ” μš”μ μ„ μ΄ν•΄ν•˜μ§€ λͺ»ν•©λ‹ˆλ‹€. ; λˆ„κ΅°κ°€κ°€ μΉœμ ˆν•˜κ²Œ λ‚˜λ₯Ό 깨우쳐 쀄 수 μžˆμŠ΅λ‹ˆλ‹€.

λ‚΄ 상황은 λ‚΄ React 앱이 nginx / Let's Encrypt ν”„λ‘μ‹œ λ’€μ˜ Docker μ»¨ν…Œμ΄λ„ˆμ—μ„œ μ‹€ν–‰λ˜λ―€λ‘œ JavaScript μ½˜μ†” 좜λ ₯에 μ•‘μ„ΈμŠ€ν•  수 μ—†λ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€. λ”°λΌμ„œ λͺ¨λ“  둜그 좜λ ₯을 syslog μ„œλ²„λ‘œ μ „λ‹¬ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€.

λ°μ΄ν„°λ² μ΄μŠ€, λ°±μ—”λ“œ 및 λ‚΄ ν”„λ‘œμ νŠΈκ°€ κ΅¬μ„±λœ λ‹€λ₯Έ μ»¨ν…Œμ΄λ„ˆμ˜ 둜그 좜λ ₯을 ν†΅ν•©ν•˜λŠ” syslog-ng Docker μ»¨ν…Œμ΄λ„ˆλ₯Ό μ„±κ³΅μ μœΌλ‘œ μ„€μ •ν–ˆμ§€λ§Œ syslogging에 λŒ€ν•œ κ°„λ‹¨ν•˜κ³  정식적인 μ ‘κ·Ό 방식을 찾지 λͺ»ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€. React ν”„λ‘ νŠΈμ—”λ“œμ˜ 좜λ ₯.

λ‚΄κ°€ μ§‘μ—μ„œ λ§Œλ“  λ©μ²­ν•œ μ†”λ£¨μ…˜μ„ ν•΄ν‚Ήν•˜κΈ° 전에 λ‚˜μ—κ²Œ 더 λ‚˜μ€ 쑰언을 쀄 μ‚¬λžŒμ΄ μžˆμŠ΅λ‹ˆκΉŒ?
μœ„μ˜ μ½”λ“œλ₯Ό μ‚¬μš©ν•˜μ—¬ console.log λ₯Ό λ„€νŠΈμ›Œν¬λ₯Ό 톡해 syslog μ„œλ²„λ‘œ λ©”μ‹œμ§€λ₯Ό λ³΄λ‚΄λŠ” 일뢀 μ½”λ“œλ‘œ λŒ€μ²΄ν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?

@z00m1n 주둜 μ‚¬μš© 사둀에 따라 λ‹€λ¦…λ‹ˆλ‹€. λΈŒλΌμš°μ €μ—μ„œ winston을 μ‚¬μš©ν•˜μ—¬ λ‚΄κ°€ λ§Œλ“œλŠ” λͺ¨λ“  μš”μ²­κ³Ό ν•¨μˆ˜ ν˜ΈμΆœμ„ κΈ°λ‘ν•©λ‹ˆλ‹€. 그리고 ν”„λ‘œλ•μ…˜ ν™˜κ²½μ— μžˆλŠ” 경우 좜λ ₯을 인쇄 였λ₯˜λ‘œλ§Œ μ œν•œν•©λ‹ˆλ‹€.

λ‚΄ μ½”λ“œλ₯Ό μ‚¬μš©ν•˜κ³  console.log 문을 λ‹€λ₯Έ κ²ƒμœΌλ‘œ κ΅ν™˜ν•˜λ©΄ μž‘λ™ν•©λ‹ˆλ‹€.

κ·ΈλŸ¬λ‚˜ 이 μž‘μ—…μ„ μˆ˜ν–‰ν•˜κΈ° μœ„ν•œ ν•΄ν‚€ μ†”λ£¨μ…˜μ„ μž‘μ„±ν•˜κΈ° 전에 μ„ΌνŠΈλ¦¬λ₯Ό μ‚¬μš©ν•˜λŠ” 것이 μ’‹μŠ΅λ‹ˆλ‹€.

λ˜ν•œ μ›ΉνŒ©μ„ μ œμ–΄ν•  수 μžˆλŠ”μ§€ 여뢀에 따라 λ‹€λ¦…λ‹ˆλ‹€. μŠ¬ν”„κ²Œλ„ 이 λ†€λΌμš΄ νŒ¨ν‚€μ§€λŠ” ꡬ쑰적으둜 κ΅¬μ‹μ΄μ–΄μ„œ μ§„μ •μœΌλ‘œ ν•΄κ²°ν•  수 μ—†μŠ΅λ‹ˆλ‹€.

@Keimeno μ΄μƒν•œ ν–‰λ™μ΄λ‚˜ μ„±λŠ₯ 문제λ₯Ό λ°œκ²¬ν•˜μ…¨μŠ΅λ‹ˆκΉŒ? 정말 μ‚¬μš©ν•˜κ³  μ‹Άμ§€λ§Œ λ‚΄ μ‚¬μš© 사둀에 λŒ€ν•œ ν”„λ‘œλ•μ…˜ ν™˜κ²½μ—μ„œ 일뢀 λ‘œκΉ…μ΄ λ°œμƒν•˜λ―€λ‘œ 맀우 μ•ˆμ •μ μ΄μ–΄μ•Ό ν•©λ‹ˆλ‹€...

@gcperrin μ„±λŠ₯ 문제라고 ν•  수 μžˆλŠ”μ§€ ν™•μ‹€ν•˜μ§€ μ•Šμ§€λ§Œ λͺ‡ 가지 벀치마크λ₯Ό μ‹€ν–‰ν•˜κ³  λ‹€μŒ κ²°κ³Όλ₯Ό μ–»μ—ˆμŠ΅λ‹ˆλ‹€.
dev ν™˜κ²½: μ½˜μ†”μ— 무언가λ₯Ό κΈ°λ‘ν•©λ‹ˆλ‹€.
prod ν™˜κ²½: 무언가λ₯Ό κΈ°λ‘ν•˜μ§€ μ•Šμ§€λ§Œ log ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•©λ‹ˆλ‹€.

_console.info(개발 ν™˜κ²½)_; 10,000개 둜그의 경우 1.863μ΄ˆμž…λ‹ˆλ‹€. (각 0,1893ms)
_logger.info(개발 ν™˜κ²½)_: 10.000개 둜그의 경우 7.980초. (각 0.7980ms)

_logger.info(ν”„λ‘œλ•νŠΈ ν™˜κ²½)_; 10,000개 둜그의 경우 3.731μ΄ˆμž…λ‹ˆλ‹€. (각 0.3731ms)

즉, ν”„λ‘œλ•μ…˜μ—μ„œ 둜거λ₯Ό μΉ¨λ¬΅μ‹œν‚€κΈ° μœ„ν•΄ λ‚΄ κΈ°λŠ₯을 μ‚¬μš©ν•˜λ©΄ 동기 μ½”λ“œκ°€ μ—¬μ „νžˆ 0.3731ms(잠재적으둜 더 높을 수 있음) λ™μ•ˆ μ‹€ν–‰λ©λ‹ˆλ‹€. μ„±λŠ₯ λ¬Έμ œκ°€ 아닐 μˆ˜λ„ μžˆμ§€λ§Œ ν”„λ‘œλ•μ…˜μ—μ„œ μžλ™μœΌλ‘œ μ‹€ν–‰λ˜λŠ” 수백 개의 λ‘œκ·Έκ°€ μžˆλŠ” 경우 μ›Ή 앱이 지연될 수 μžˆμŠ΅λ‹ˆλ‹€.

λΈŒλΌμš°μ € μΈ‘μ—μ„œ 파일 μ‹œμŠ€ν…œμ— λ‘œκ·ΈμΈμ„ μœ μ§€ν•˜κΈ° μœ„ν•΄ winston을 μ‚¬μš©ν•˜λŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

React μ• ν”Œλ¦¬μΌ€μ΄μ…˜μ΄ 있고 ν΄λΌμ΄μ–ΈνŠΈ μΈ‘ 둜그λ₯Ό 파일 μ‹œμŠ€ν…œμ— μ €μž₯ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€. 제발 λͺ‡ 가지 생각을 μ œμ•ˆν•˜μ‹­μ‹œμ˜€.

미리 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€.

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