From 89c7a04ad659e6bf23a21bc0a6459401d25fa60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Fri, 8 Apr 2022 00:23:04 -0300 Subject: [PATCH] fix: use logger instance in Ignite class --- package.json | 2 +- src/Ignite.ts | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e08e373..12334d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "1.2.0", + "version": "1.2.1", "description": "", "license": "MIT", "author": "João Lenon ", diff --git a/src/Ignite.ts b/src/Ignite.ts index 63772c5..20ef287 100644 --- a/src/Ignite.ts +++ b/src/Ignite.ts @@ -13,7 +13,7 @@ import '@athenna/ioc' import '@athenna/config/src/Utils/global' -import { Log } from 'src/Facades/Log' +import { Logger } from '@athenna/logger' import { Application } from 'src/Application' import { resolveEnvFile } from '@athenna/config' import { normalize, parse, resolve } from 'path' @@ -21,6 +21,13 @@ import { File, Path, resolveModule } from '@secjs/utils' import { DuplicatedApplicationException } from 'src/Exceptions/DuplicatedApplicationException' export class Ignite { + /** + * Simple logger for Ignite class. + * + * @private + */ + private logger: Logger + /** * An instance of the application. Is here that the * client will bootstrap his type of application. @@ -66,6 +73,12 @@ export class Ignite { this.clearConsole() + /** + * Using import because logger needs to be set after + * resolveNodeEnv method has been called. + */ + this.logger = resolveModule(await import('./Utils/Logger')) + const providers = await this.getProviders() await this.registerProviders(providers) @@ -188,7 +201,9 @@ export class Ignite { providersNormalized.push(resolveModule(Provider)) }) - providersNormalized.forEach(p => Log.success(`Registering ${p.name}`)) + providersNormalized.forEach(p => + this.logger.success(`Registering ${p.name}`), + ) return providersNormalized } @@ -246,7 +261,7 @@ export class Ignite { preload = normalize(preload) const { dir, name } = parse(Path.config(preload)) - Log.success(`Preloading ${name} file`) + this.logger.success(`Preloading ${name} file`) return import(`${dir}/${name}${this.extension}`) })