winston: Attempt to write logs with no transports - using default logger

In winston 3 you need to create a logger object, then add transports to it.

Winston 3 has many examples, but to adapt from the readme, do something like this:

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({ filename: 'logfile.log' })
  ]
});

logger.info('it works!!');

If you want to use the default logger in winston v3 then you simply have to add this piece of code in your main file

const winston = require('winston')

winston.add(new winston.transports.File({ filename: 'logfile.log' }))

I also had a similar issue. If I recall correctly, I had to call the requirement as a function in my index.js.

require('./logging')();