Fix API logger configuration (handle invalid or missing config valeus properly).

This commit is contained in:
Jonathan Bernard 2019-05-18 12:22:30 -05:00
parent 0ce1581a87
commit 6380c73421

View File

@ -64,18 +64,10 @@ export default class App extends Vue {
this.consoleLogAppender.threshold = commonLevel;
}
try {
this.apiLogAppender.batchSize =
parseInt(process.env.VUE_APP_API_LOG_BATCH_SIZE, 10);
} catch {
this.apiLogAppender.batchSize = 5;
}
const batchSize = parseInt(process.env.VUE_APP_API_LOG_BATCH_SIZE, 10);
if (!isNaN(batchSize)) { this.apiLogAppender.batchSize = Math.max(batchSize, 1); }
try {
this.apiLogAppender.minimumTimePassedInSec
= parseInt(process.env.VUE_APP_API_LOG_MIN_TIME_PASSED_IN_SEC, 10);
} catch {
this.apiLogAppender.minimumTimePassedInSec = 5;
}
const minTimeInSec = parseInt(process.env.VUE_APP_API_LOG_MIN_TIME_PASSED_IN_SEC, 10);
if (!isNaN(minTimeInSec)) { this.apiLogAppender.minimumTimePassedInSec = Math.max(minTimeInSec, 1); }
}
}