From d42ee3c9721648623f231466c26a35be678fc25e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 23 Dec 2022 16:20:34 +0100 Subject: [PATCH] Document log rotation directives MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- README.md | 3 ++- src/assets/config-template.json | 1 + src/utils/Logger.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 637f20da..39e45b10 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,8 @@ But the modifications to test have to be done to the files in the build target d | logConsole | true/false | false | boolean | output logs on the console | | logFormat | | simple | string | winston log format | | logRotate | true/false | true | boolean | enable daily log files rotation | -| logMaxFiles | | 7 | integer | maximum number of log files to keep | +| logMaxFiles | x, "xd" where x is an integer | undefined | integer \| string | maximum number of log files | +| logMaxSize | x, "xk", "xm", "xg" where x is a number | undefined | number \| string | maximum size of log files in bytes, or units of kB, mB, and gB | | logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level | | logFile | | combined.log | string | log file relative path | | logErrorFile | | error.log | string | error log file relative path | diff --git a/src/assets/config-template.json b/src/assets/config-template.json index 9ad01aa1..e1620aa7 100644 --- a/src/assets/config-template.json +++ b/src/assets/config-template.json @@ -44,6 +44,7 @@ } ], "logStatisticsInterval": 0, + "logMaxFiles": 7, "logFile": "combined.log", "logErrorFile": "error.log" } diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index 61e4b0bc..c3ea5c5c 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -7,7 +7,7 @@ import Configuration from './Configuration'; import Utils from './Utils'; let transports: transport[]; -if (Configuration.getLogRotate()) { +if (Configuration.getLogRotate() === true) { const logMaxFiles = Configuration.getLogMaxFiles(); const logMaxSize = Configuration.getLogMaxSize(); transports = [ -- 2.34.1