import { EventManager , Inject , Service } from "@bluelibs/core" ; import { ILogger , LogLevel } from "../defs" ; import { Log } from "../models" ; import { LogEvent } from "../events" ; @ Service ( ) export class LoggerService implements ILogger { constructor ( protected readonly eventManager ) { } param log returns async send ( log ) { return this . eventManager . emit ( new LogEvent ( { log } ) ) ; } /**
     * Log a critical message. Critical logs are used for security breaches or things that have high business impact
     */ async critical ( message , context ? ) { const log = new Log ( message , LogLevel . CRITICAL , context ) ; await this . send ( log ) ; } /**
     * Log an info type log. Info logs described actions that have been done or are about to happen
     */ async info ( message , context ? ) { const log = new Log ( message , LogLevel . INFO , context ) ; await this . send ( log ) ; } /**
     * Warnings happen
     */ async warning ( message , context ? ) { const log = new Log ( message , LogLevel . WARNING , context ) ; await this . send ( log ) ; } async error ( message , context ? ) { const log = new Log ( message , LogLevel . ERROR , context ) ; await this . send ( log ) ; } }