Skip to content

Commit

Permalink
fix: use logger instance in Ignite class
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Apr 8, 2022
1 parent ad10349 commit 89c7a04
Show file tree
Hide file tree
Showing 2 changed files with 19 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.2.0",
"version": "1.2.1",
"description": "",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
21 changes: 18 additions & 3 deletions src/Ignite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,21 @@
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'
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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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}`)
})
Expand Down

0 comments on commit 89c7a04

Please sign in to comment.