-
-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(di): add attach logger function util to create custom DI container
- Loading branch information
Showing
4 changed files
with
31 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {Logger} from "@tsed/logger"; | ||
import {InjectorService} from "../services/InjectorService"; | ||
import {attachLogger} from "./attachLogger"; | ||
|
||
describe("attachLogger", () => { | ||
it("should attach logger", () => { | ||
const injector = new InjectorService(); | ||
const $log = new Logger("test"); | ||
|
||
attachLogger(injector, $log); | ||
|
||
expect(injector.logger).toEqual($log); | ||
}); | ||
}); |
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,8 @@ | ||
import type {Logger} from "@tsed/logger"; | ||
import {InjectorService} from "../services/InjectorService"; | ||
import {setLoggerConfiguration} from "./setLoggerConfiguration"; | ||
|
||
export function attachLogger(injector: InjectorService, $log: Logger) { | ||
injector.logger = $log; | ||
setLoggerConfiguration(injector); | ||
} |