Fix DI bugs; implement general logging service
This commit is contained in:
30
lib/src/unit/Scaffolding.ts
Normal file
30
lib/src/unit/Scaffolding.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import LifecycleUnit from '../lifecycle/Unit.ts'
|
||||
import { Unit } from '../lifecycle/decorators.ts'
|
||||
import { dotenv } from '../external/std.ts'
|
||||
import { Logging } from '../service/logging/Logging.ts'
|
||||
import StandardLogger from '../service/logging/StandardLogger.ts'
|
||||
|
||||
@Unit()
|
||||
export default class Scaffolding extends LifecycleUnit {
|
||||
private config = {}
|
||||
|
||||
constructor(
|
||||
protected logger: Logging
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
public refresh_env() {
|
||||
this.config = dotenv()
|
||||
}
|
||||
|
||||
public setup_logging() {
|
||||
StandardLogger.register()
|
||||
this.logger.info('Logging initialized.', true)
|
||||
}
|
||||
|
||||
public async up() {
|
||||
this.setup_logging()
|
||||
this.refresh_env()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user