Error: Invalid transport, must be an object with a log method

in Nodejs course, handling and logging errors chapter, lectures 6 & 7 Mosh has added a new logfile.log by this approach:
“winston.add(winston.transports.File , {filename : ‘logfile.log’});”
but this approach is no longer valid so instead, you have to use this:
" winston.add(
new winston.transports.File({filename:‘logfile.log’})); ".

you also have to modify the approach of adding new log to mongoDB by :
“winston.add(
new winston.transports.MongoDB({db:‘mongodb://127.0.0.1/vidly’}));”

2 Likes