Cannot create property 'Symbol(level) for logger.log

broccoli·2021년 5월 12일
0

logging

목록 보기
1/4
post-thumbnail

winston 사용시 나타날 수 있는 이슈

const Logger from './logger'

Logger.log('logging입니다.')

위와 같이 단순히 console.logLogger.log로 변경했을 시 발생한다. winstonlog함수는 console.log와 같은 의미가 아니다. 좀 더 포괄적인 의미의 로그이므로 console.log와 같은 의미로 사용하려면 debug를 사용해라.

어떤 로그인지 첫번째 인자에 넘겨줘야한다.

winstonlogger.log('error', 'The transaction failed.');

Leaving this here for others who come to this thread. The winstonlogger object does have a .log() method. However, unlike console.log(), it requires two arguments, not just one. If you forget the first argument, the log message category, you will get the Symbol(level) error.

console.log를 사용했던것을 변경할때는 Logger.debug를 사용하자

참고링크

profile
🌃브로콜리한 개발자🌟

0개의 댓글