I have a problem with winston, follow my settings:
const logger = winston.createLogger({
level: 'info',
format: winston.format.json(),
transport: [
new winston.transports.File({ filename: './../error.log', level: 'error', json: true }),
new winston.transports.File({ filename: './../info.log', json: true }),
new winston.transports.Console()
]
});
Here is the piece of code where I request to generate log:
.catch(err => logger.error({
message: 'Erro ao cadastrar usuário',
data: err
}));
Here is the alert that appears in the attempt to generate the log:
NOTE: I'm just sending the beginning of the message that appears because it is a bit big because of json
[winston] Attempt to write logs with no transports {"message":"Erro ao cadastrar usuário","data":{"name":
This is my problem, in trying to generate the log it gives me back this.