Adding automatic logfile creation depending on name

This commit is contained in:
Fabian Stamm
2018-09-01 16:57:21 +02:00
parent 4918fe9b17
commit e973ab7e59
5 changed files with 35 additions and 6 deletions

View File

@ -59,6 +59,15 @@ export class LoggingBase {
constructor(options?: Partial<LoggingBaseOptions>) {
if (!options) options = {};
if (options.name) {
if (options.logfile === undefined) {
options.logfile = `./logs/all.${options.name}.log`
}
if (options.errorfile === undefined) {
options.logfile = `./logs/error.${options.name}.log`
}
}
this.config = Object.assign(<LoggingBaseOptions>{
name: undefined,
console_out: true,