diff --git a/.gitignore b/.gitignore index 4a41c0e..e6ebd13 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ data mocks .idea *vendor* +*.log diff --git a/utils/logger.go b/utils/logger.go index 74dbd3e..3db21f2 100644 --- a/utils/logger.go +++ b/utils/logger.go @@ -7,10 +7,14 @@ import ( "go.uber.org/zap" ) +const logFile = "app.log" + // NewLogger creates a new zap logger func NewLogger() (*zap.Logger, error) { if os.Getenv(environment.Environment) == "prod" { - return zap.NewProduction() + cfg := zap.NewProductionConfig() + cfg.OutputPaths = []string{logFile, os.Stdout.Name()} + return cfg.Build() } return zap.NewDevelopment() }