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