Created
April 5, 2020 05:48
-
-
Save presmihaylov/b9513b6bc2ffee94a1c9ad68092affb1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
... | |
// ProvideLogger to fx | |
func ProvideLogger() *zap.SugaredLogger { | |
logger, _ := zap.NewProduction() | |
slogger := logger.Sugar() | |
return slogger | |
} | |
func main() { | |
fx.New( | |
fx.Provide(ProvideConfig), | |
fx.Provide(ProvideLogger), | |
).Run() | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We can also write
fx.New
as following