npm
-
[NodeJs] winston모듈을 사용하여 로그 저장하기프레임워크/NodeJs 2020. 10. 20. 21:29
먼저 아래 두개의 모듈을 설치해줍니다. $ npm install winston $ npm install winston-daily-rotate-file winston-daily-rotate-file : 날짜에 따라 자동으로 파일이 생성되며 로그가 쌓일 수 있도록 도와주는 모듈 제가 사용한 버전은 아래와 같습니다. "winston": "^3.3.3" "winston-daily-rotate-file": "^4.5.0" 저는 logSave.js 라는 파일을 만든 후, 해당 파일을 모듈화하여 사용하였습니다. const winston = require('winston'); require('winston-daily-rotate-file'); // level 종류 // error:0 , warn:1, info:2, h..