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 | import { ContainerConstants } from '@medjaibot/framework/constants/ContainerConstants'; import { DateTimeFormatter } from '@medjaibot/framework/logger/formatter/DateTimeFormatter'; import { TTYLogLevelFormatter } from '@medjaibot/framework/logger/formatter/TTYLogLevelFormatter'; import { LogLevel } from '@medjaibot/framework/logger/LogLevel'; import { TTYLogger } from '@medjaibot/framework/logger/TTYLogger'; import { ContainerModule } from 'inversify'; export class LoggerModule extends ContainerModule { constructor() { super((bind) => { bind(ContainerConstants.LOGGING.FORMATTER.DATETIME).to(DateTimeFormatter); bind(ContainerConstants.LOGGING.FORMATTER.LOGLEVEL).to(TTYLogLevelFormatter); bind(ContainerConstants.LOGGING.STREAMS.OUT).toConstantValue(process.stdout); bind(ContainerConstants.LOGGING.STREAMS.ERROR).toConstantValue(process.stderr); bind(ContainerConstants.LOGGING.LOGLEVEL).toConstantValue(LogLevel.INFO); bind(ContainerConstants.LOGGING.LOGGER).to(TTYLogger).onActivation((context) => { const logger = new TTYLogger( context.container.get(ContainerConstants.LOGGING.STREAMS.OUT), context.container.get(ContainerConstants.LOGGING.STREAMS.ERROR), context.container.get(ContainerConstants.LOGGING.LOGLEVEL), context.container.get(ContainerConstants.LOGGING.FORMATTER.DATETIME), context.container.get(ContainerConstants.LOGGING.FORMATTER.LOGLEVEL), ); if ( context.currentRequest.parentRequest !== null && context.currentRequest.parentRequest.parentRequest !== null ) { // tslint:disable-next-line: no-any const implementationType: any = context.currentRequest .parentRequest.parentRequest.bindings[0].implementationType; logger.className = implementationType.name; } return logger; }); }); } } |