From 1e26652addfbc33c87ea46dd5f71cbbd8235d41f Mon Sep 17 00:00:00 2001 From: Vianney Foucault Date: Sat, 19 Oct 2024 23:06:59 +0200 Subject: [PATCH] feat: WithLogger Provider Option (#833) --- provider_options.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/provider_options.go b/provider_options.go index 15ee99006..400b810e8 100644 --- a/provider_options.go +++ b/provider_options.go @@ -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