-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: support v3 logger * feat: support alias name in logger service * chore: use logger v3 * chore: use logger v3 beta * fix: typings * fix: lint * chore: upgrade to beta19 * fix: web logger * fix: web case * fix: build * fix: cron logger case * fix: logger api * chore: update logger to 3.0.0 release * docs: update logger document * chore: update logger version
- Loading branch information
1 parent
56920d4
commit a4586da
Showing
47 changed files
with
2,956 additions
and
908 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ docs-api | |
site/changelog | ||
.changelog | ||
**/test/*.txt | ||
.audit |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,52 @@ | ||
import { ILogger } from '../interface'; | ||
import { ILogger, MidwayAppInfo } from '../interface'; | ||
|
||
export abstract class LoggerFactory<Logger extends ILogger, LoggerOptions> { | ||
abstract createLogger(name: string, options: LoggerOptions): Logger; | ||
abstract getLogger(loggerName: string): Logger; | ||
abstract close(loggerName?: string); | ||
abstract removeLogger(loggerName: string); | ||
abstract getDefaultMidwayLoggerConfig(appInfo: MidwayAppInfo): { | ||
midwayLogger: { | ||
default?: LoggerOptions; | ||
clients?: { | ||
[loggerName: string]: LoggerOptions; | ||
}; | ||
}; | ||
}; | ||
abstract createContextLogger( | ||
ctx: any, | ||
appLogger: ILogger, | ||
contextOptions?: any | ||
): ILogger; | ||
} | ||
|
||
export class DefaultConsoleLoggerFactory | ||
implements LoggerFactory<ILogger, any> | ||
{ | ||
createLogger(name: string, options: any): ILogger { | ||
return console; | ||
} | ||
getLogger(loggerName: string): ILogger { | ||
return console; | ||
} | ||
close(loggerName?: string) {} | ||
removeLogger(loggerName: string) {} | ||
|
||
getDefaultMidwayLoggerConfig(): { | ||
midwayLogger: { default?: any; clients?: { [p: string]: any } }; | ||
} { | ||
return { | ||
midwayLogger: { | ||
default: {}, | ||
clients: { | ||
coreLogger: {}, | ||
appLogger: {}, | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
createContextLogger(ctx: any, appLogger: ILogger): ILogger { | ||
return appLogger; | ||
} | ||
} |
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
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
Oops, something went wrong.