+const logConfiguration = Configuration.getConfigurationSection<LogConfiguration>(
+ ConfigurationSection.log,
+);
+let transports: transport[];
+if (logConfiguration.rotate === true) {
+ const logMaxFiles = logConfiguration.maxFiles;
+ const logMaxSize = logConfiguration.maxSize;
+ transports = [
+ new DailyRotateFile({
+ filename: insertAt(
+ logConfiguration.errorFile!,
+ '-%DATE%',
+ logConfiguration.errorFile!.indexOf('.log'),
+ ),
+ level: 'error',
+ ...(logMaxFiles && { maxFiles: logMaxFiles }),
+ ...(logMaxSize && { maxSize: logMaxSize }),
+ }),
+ new DailyRotateFile({
+ filename: insertAt(logConfiguration.file!, '-%DATE%', logConfiguration.file!.indexOf('.log')),
+ ...(logMaxFiles && { maxFiles: logMaxFiles }),
+ ...(logMaxSize && { maxSize: logMaxSize }),
+ }),
+ ];
+} else {
+ transports = [
+ new TransportType.File({
+ filename: logConfiguration.errorFile,
+ level: 'error',
+ }),
+ new TransportType.File({
+ filename: logConfiguration.file,
+ }),
+ ];
+}