-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ctx get logger with custom logger (#3648)
* fix: ctx get logger with custom logger * fix: ctx get logger with custom logger
- Loading branch information
1 parent
32f710b
commit 4a9f039
Showing
7 changed files
with
177 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/core/test/fixtures/base-app-custom-framework-logger/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "ali-demo" | ||
} |
30 changes: 30 additions & 0 deletions
30
packages/core/test/fixtures/base-app-custom-framework-logger/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Configuration, App, Logger } from '../../../../src'; | ||
import { IMidwayApplication } from '../../../../src'; | ||
import { ILogger } from '@midwayjs/logger'; | ||
|
||
@Configuration({ | ||
importConfigs: { | ||
midwayLogger: { | ||
default: { | ||
enableFile: false, | ||
enableError: false, | ||
}, | ||
clients: { | ||
customLogger: { | ||
enableConsole: true, | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
export class AutoConfiguration { | ||
|
||
@App() | ||
app: IMidwayApplication; | ||
|
||
@Logger() | ||
logger: ILogger; | ||
|
||
async onReady() { | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/core/test/fixtures/base-app-custom-framework-logger/src/framework.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BaseFramework, Framework, IMidwayBootstrapOptions } from '../../../../src'; | ||
|
||
@Framework() | ||
export class CustomFramework extends BaseFramework<any, any, any> { | ||
applicationInitialize(options: IMidwayBootstrapOptions) { | ||
this.app = {}; | ||
} | ||
|
||
configure(options: any) { | ||
return this.configService.getConfiguration('custom'); | ||
} | ||
|
||
run(): Promise<void> { | ||
this.app.getCoreLogger().info('run custom framework'); | ||
return Promise.resolve(undefined); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters