Skip to content

Commit 9b3fd31

Browse files
authored
Merge pull request #16 from AthennaIO/develop
fix: do not use Logger import in application class
2 parents acb8136 + b4fd9e3 commit 9b3fd31

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/core",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "",
55
"license": "MIT",
66
"author": "João Lenon <[email protected]>",

src/Application.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import { parse } from 'path'
1111
import { Ioc } from '@athenna/ioc'
1212
import { Path } from '@secjs/utils'
13-
import { Logger } from 'src/Utils/Logger'
13+
import { Logger } from '@athenna/logger'
1414
import { Http, Router as HttpRoute } from '@athenna/http'
1515
import { ResolveClassExport } from 'src/Utils/ResolveClassExport'
1616
import { AthennaErrorHandler } from 'src/Utils/AthennaErrorHandler'
@@ -19,6 +19,13 @@ import { AlreadyBootedException } from 'src/Exceptions/AlreadyBootedException'
1919
import { AlreadyShutdownException } from 'src/Exceptions/AlreadyShutdownException'
2020

2121
export class Application {
22+
/**
23+
* Simple logger for Application class.
24+
*
25+
* @private
26+
*/
27+
private logger: Logger
28+
2229
/**
2330
* An instance of the Ioc class that is a Monostate with
2431
* the Awilix container inside.
@@ -42,6 +49,7 @@ export class Application {
4249
this.httpServer = null
4350
this.httpRoute = null
4451
this.extension = extension
52+
this.logger = ResolveClassExport.resolve(require('./Utils/Logger'))
4553
}
4654

4755
/**
@@ -127,7 +135,7 @@ export class Application {
127135

128136
await this.httpServer.listen(port, host)
129137

130-
Logger.log(`Http server started on http://${host}:${port}`)
138+
this.logger.log(`Http server started on http://${host}:${port}`)
131139

132140
return this.httpServer
133141
}
@@ -159,7 +167,7 @@ export class Application {
159167
private preloadFile(filePath: string) {
160168
const { dir, name } = parse(filePath)
161169

162-
Logger.log(`Preloading ${name} file`)
170+
this.logger.log(`Preloading ${name} file`)
163171

164172
require(`${dir}/${name}${this.extension}`)
165173
}

0 commit comments

Comments
 (0)