From 3ffef5376edb3c7e81c80e0bf34cfaa8c51ce401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Tue, 5 Apr 2022 23:48:42 -0300 Subject: [PATCH 1/2] fix: do not use Logger import in application class --- package.json | 2 +- src/Application.ts | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1026a45..7a86367 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "1.1.3", + "version": "1.1.4", "description": "", "license": "MIT", "author": "João Lenon ", diff --git a/src/Application.ts b/src/Application.ts index aeb20b5..3117c40 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -10,7 +10,7 @@ import { parse } from 'path' import { Ioc } from '@athenna/ioc' import { Path } from '@secjs/utils' -import { Logger } from 'src/Utils/Logger' +import { Logger } from '@athenna/logger' import { Http, Router as HttpRoute } from '@athenna/http' import { ResolveClassExport } from 'src/Utils/ResolveClassExport' import { AthennaErrorHandler } from 'src/Utils/AthennaErrorHandler' @@ -19,6 +19,13 @@ import { AlreadyBootedException } from 'src/Exceptions/AlreadyBootedException' import { AlreadyShutdownException } from 'src/Exceptions/AlreadyShutdownException' export class Application { + /** + * Simple logger for Application class. + * + * @private + */ + private logger: Logger + /** * An instance of the Ioc class that is a Monostate with * the Awilix container inside. @@ -42,6 +49,7 @@ export class Application { this.httpServer = null this.httpRoute = null this.extension = extension + this.logger = require('./Utils/Logger') } /** @@ -127,7 +135,7 @@ export class Application { await this.httpServer.listen(port, host) - Logger.log(`Http server started on http://${host}:${port}`) + this.logger.log(`Http server started on http://${host}:${port}`) return this.httpServer } @@ -159,7 +167,7 @@ export class Application { private preloadFile(filePath: string) { const { dir, name } = parse(filePath) - Logger.log(`Preloading ${name} file`) + this.logger.log(`Preloading ${name} file`) require(`${dir}/${name}${this.extension}`) } From b4fd9e3337e468ca215a06f5792fc359f459e138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lenon?= Date: Tue, 5 Apr 2022 23:51:14 -0300 Subject: [PATCH 2/2] fix: use resolve class export to get logger --- src/Application.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application.ts b/src/Application.ts index 3117c40..2e26832 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -49,7 +49,7 @@ export class Application { this.httpServer = null this.httpRoute = null this.extension = extension - this.logger = require('./Utils/Logger') + this.logger = ResolveClassExport.resolve(require('./Utils/Logger')) } /**