Skip to content

Commit

Permalink
Merge pull request #16 from AthennaIO/develop
Browse files Browse the repository at this point in the history
fix: do not use Logger import in application class
  • Loading branch information
jlenon7 authored Apr 6, 2022
2 parents acb8136 + b4fd9e3 commit 9b3fd31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/core",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
14 changes: 11 additions & 3 deletions src/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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.
Expand All @@ -42,6 +49,7 @@ export class Application {
this.httpServer = null
this.httpRoute = null
this.extension = extension
this.logger = ResolveClassExport.resolve(require('./Utils/Logger'))
}

/**
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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}`)
}
Expand Down

0 comments on commit 9b3fd31

Please sign in to comment.