import { Injectable, IPlugin } from '@tiejs/common'
@Injectable()
export default class LoggerPlugin implements IPlugin {
constructor(@InjectApp() private app: Application) {
let { middlewareConfig } = this.app
middlewareConfig.unshift({
name: 'logger',
use: LoggerMiddleware
})
}
appDidReady() {
console.log('server will start')
}
configDidLoad() {
console.log('app loaded')
}
middlewareDidReady() {
console.log('app.use(middleware) ready')
}
serverDidReady() {
console.log('server start')
}
}