import { forwardRef , Inject , Injectable } from '@angular/core' ; import { ConfigService } from '@ngx-config/core' ; import { ConsoleService } from './console.service' ; import { LogLevel } from './models/log-level' ; @ Injectable ( ) export class LogService { constructor ( private readonly config , @ Inject ( forwardRef ( ( ) => ConsoleService ) ) readonly logger ) { } debug ( msg ) { if ( this . config . getSettings ( 'logging.level' ) >= LogLevel . Debug ) { this . logger . log ( msg ) ; } } error ( err ) { if ( this . config . getSettings ( 'logging.level' ) >= LogLevel . Error ) { this . logger . error ( err ) ; } } warn ( err ) { if ( this . config . getSettings ( 'logging.level' ) >= LogLevel . Warn ) { this . logger . warn ( err ) ; } } info ( err ) { if ( this . config . getSettings ( 'logging.level' ) >= LogLevel . Info ) { this . logger . info ( err ) ; } } }