From b578ce895ee18016ccb638a5b7ed69fb36997464 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 31 Aug 2020 14:05:21 -0400 Subject: [PATCH] limit the size and number of log files, rotate automatically Signed-off-by: Sebastian Malton --- src/main/logger.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/logger.ts b/src/main/logger.ts index 433fe0b005..fc7fcbf771 100644 --- a/src/main/logger.ts +++ b/src/main/logger.ts @@ -1,3 +1,4 @@ +import { app } from "electron"; import winston from "winston" import { isDebugging } from "../common/vars"; @@ -10,7 +11,10 @@ const fileOptions: winston.transports.FileTransportOptions = { handleExceptions: false, level: isDebugging ? "debug" : "info", filename: "lens.log", - dirname: __dirname, + dirname: app.getPath("logs"), + maxsize: 16 * 1024, + maxFiles: 16, + tailable: true, } const logger = winston.createLogger({