-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WithLogger: Support decoration (#872)
`fx.WithLogger` does not currently respect decorations made with `fx.Decorate` or `fx.Replace`. The reasons for this are two fold: 1. App runs decorations *after* constructing the custom logger. This means that dig doesn't know about the decorations at this time. 2. App provides and invokes the custom logger on the `dig.Container`, while the decorations begin running at the root `dig.Scope` held by Fx. So the container that we run the custom logger off doesn't know about the decorator because it's one layer down. This PR moves decoration to run before the custom logger is constructed, and changes the custom logger instantiation code to operate on the root scope. Resolves #860 Refs GO-1341
- Loading branch information
Showing
4 changed files
with
29 additions
and
11 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
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