import { Injectable } from '@angular/core' ; import { TranslateService } from './translate.service' ; @ Injectable ( ) export class LoggerService { constructor ( private translate ) { } public log ( component , msg ? , i18nRef ? , data ? ) { if ( true ) { if ( i18nRef ) { let params = { } ; if ( data ) { params = ( data [ 0 ] ) ? { 0 : data [ 0 ] } : params ; params = ( data [ 1 ] ) ? { 0 : data [ 0 ] , 1 : data [ 1 ] } : params ; params = ( data [ 2 ] ) ? { 0 : data [ 0 ] , 1 : data [ 1 ] , 2 : data [ 2 ] } : params ; } this . translate . getTranslate ( ) . get ( i18nRef , params ) . subscribe ( ( res ) => { console . log ( component + ': ' + res ) ; } ) ; } else { console . log ( component + ': ' + msg ) ; } } } }