: true;
}
- static getLogMaxFiles(): number {
- return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'logMaxFiles')
- ? Configuration.getConfig().logMaxFiles
- : 7;
+ static getLogMaxFiles(): number | string | undefined {
+ return (
+ Configuration.objectHasOwnProperty(Configuration.getConfig(), 'logMaxFiles') &&
+ Configuration.getConfig().logMaxFiles
+ );
+ }
+
+ static getLogMaxSize(): number | string | undefined {
+ return (
+ Configuration.objectHasOwnProperty(Configuration.getConfig(), 'logMaxFiles') &&
+ Configuration.getConfig().logMaxSize
+ );
}
static getLogLevel(): string {
let transports: transport[];
if (Configuration.getLogRotate()) {
const logMaxFiles = Configuration.getLogMaxFiles();
+ const logMaxSize = Configuration.getLogMaxSize();
transports = [
new DailyRotateFile({
filename: Utils.insertAt(
Configuration.getLogErrorFile().indexOf('.log')
),
level: 'error',
- maxFiles: logMaxFiles,
+ ...(logMaxFiles && { maxFiles: logMaxFiles }),
+ ...(logMaxSize && { maxSize: logMaxSize }),
}),
new DailyRotateFile({
filename: Utils.insertAt(
'-%DATE%',
Configuration.getLogFile().indexOf('.log')
),
- maxFiles: logMaxFiles,
+ ...(logMaxFiles && { maxFiles: logMaxFiles }),
+ ...(logMaxSize && { maxSize: logMaxSize }),
}),
];
} else {