feat(logs): rotate log files if they reach 20MB in size

closes #438
pull/470/head
sct 4 years ago
parent 659fa505f0
commit 22002ab4c7

2
.gitignore vendored

@ -36,7 +36,7 @@ config/db/db.sqlite3
config/settings.json config/settings.json
# logs # logs
config/logs/*.log config/logs/*.log*
# dist files # dist files
dist dist

@ -16,15 +16,23 @@ const hformat = winston.format.printf(
const logger = winston.createLogger({ const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'debug', level: process.env.LOG_LEVEL || 'debug',
format: winston.format.combine( format: winston.format.combine(
winston.format.colorize(),
winston.format.splat(), winston.format.splat(),
winston.format.timestamp(), winston.format.timestamp(),
hformat hformat
), ),
transports: [ transports: [
new winston.transports.Console(), new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.splat(),
winston.format.timestamp(),
hformat
),
}),
new winston.transports.File({ new winston.transports.File({
filename: path.join(__dirname, '../config/logs/overseerr.log'), filename: path.join(__dirname, '../config/logs/overseerr.log'),
maxsize: 20971520,
maxFiles: 6,
}), }),
], ],
}); });

Loading…
Cancel
Save