All files / services/bootstrap-logger bootstrap-logger.ts

30.77% Statements 8/26
20% Branches 3/15
14.29% Functions 1/7
25% Lines 6/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 582x 2x 2x     2x   2x                             1x                                                                      
import { Service } from '../../container';
import { ConfigService } from '../config';
import { Injector } from '../../decorators/injector/injector.decorator';
 
@Service()
export class BootstrapLogger {
 
    @Injector(ConfigService) configService: ConfigService;
 
    log(message: string) {
        if (this.configService.config.logger.logging) {
            const m = [this.logDate(), message];
            console.log(...m);
            return m;
        }
    }
 
    error(message: string) {
        console.error(message);
    }
 
    logImporter(message: string) {
        Iif (this.configService.config.logger.logging) {
            return this.log(message);
        }
    }
 
    logDate() {
        if (this.configService.config.logger.date) {
            return `${Date.now().toPrecision()}`;
        } else {
            return '';
        }
    }
 
    logFileService(message: string) {
        if (this.configService.config.logger.fileService) {
            this.log(message);
            return '``';
        }
    }
 
    logHashes(message: string) {
        if (this.configService.config.logger.hashes) {
            return message;
        } else {
            return '';
        }
    }
 
    logExitHandler(message: string) {
        if (this.configService.config.logger.exitHandler) {
            this.log(message);
        } else {
            return '';
        }
    }
}