Hello everybody. I have a problem - not writing to the file. The recording is done by winston. I test it on the server of my computer - everything is ok. I upload it here - the file is not written. The rights to the file were added by 777.
Here is the code:
const options = {
fileInfo: {
level: 'info',
filename: `${appRoot} / info.txt`,
handleExceptions: true,
json: true,
maxsize: 5242880, // 5MB
maxFiles: 5,
colorize: true,
}
};
// instantiate a new Winston Logger with the settings defined above
const logger = new winston.createLogger ({
transports: [
new winston.transports.File (options.fileInfo)
],
exitOnError: false, // do not exit on handled exceptions
});
// create a stream object with a 'write' function that will be used by `morgan`
logger.stream = {
write: function (message, encoding) {
logger.info (message);
}
};
Please help me figure it out.