Skip to content

Commit

Permalink
feat: WithLogger Provider Option (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfoucault authored Oct 19, 2024
1 parent a02d852 commit 1e26652
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions provider_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ func WithDisableVersioning(b bool) ProviderOption {
})
}

// WithLogger set the logger, same behavior as with goose.SetLogger(logger)
// Using Provider would block the ability to override the logger, which could become painful to have a proper
// structured logging. By Default, this won't override the default logger.
func WithLogger(l Logger) ProviderOption {
return configFunc(func(c *config) error {
c.logger = l
return nil
})
}

type config struct {
store database.Store

Expand Down

0 comments on commit 1e26652

Please sign in to comment.