Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-08-21 14:05:55 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-08-21 14:53:24 +0300
commitbba43e624cf7d070e0dfab99287dcd90cc8ca160 (patch)
treee842a8d0e459dca51a3e38ecde2017371fdfb322
parentc9645cfd3307df247709458943d6ac1ef6196077 (diff)
git/command_factory: Use injected logging instance
We're using the global logging instance provided by `log.Default()`, which is about to go away soon. Refactor the code to instead pass in a proprely configured logging instance.
-rw-r--r--internal/git/command_factory.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go
index 56b0e33d9..812f4ef2e 100644
--- a/internal/git/command_factory.go
+++ b/internal/git/command_factory.go
@@ -157,7 +157,7 @@ func NewExecCommandFactory(cfg config.Cfg, logger logrus.FieldLogger, opts ...Ex
}
}()
- hookDirectories, cleanup, err := setupHookDirectories(cfg, factoryCfg)
+ hookDirectories, cleanup, err := setupHookDirectories(cfg, factoryCfg, logger)
if err != nil {
return nil, nil, fmt.Errorf("setting up hooks: %w", err)
}
@@ -310,7 +310,7 @@ func (cf *ExecCommandFactory) HooksPath(ctx context.Context) string {
return cf.hookDirs.tempHooksPath
}
-func setupHookDirectories(cfg config.Cfg, factoryCfg execCommandFactoryConfig) (hookDirectories, func(), error) {
+func setupHookDirectories(cfg config.Cfg, factoryCfg execCommandFactoryConfig, logger logrus.FieldLogger) (hookDirectories, func(), error) {
if factoryCfg.hooksPath != "" {
return hookDirectories{
tempHooksPath: factoryCfg.hooksPath,
@@ -339,7 +339,7 @@ func setupHookDirectories(cfg config.Cfg, factoryCfg execCommandFactoryConfig) (
tempHooksPath: tempHooksPath,
}, func() {
if err := os.RemoveAll(tempHooksPath); err != nil {
- log.Default().WithError(err).Error("cleaning up temporary hooks path")
+ logger.WithError(err).Error("cleaning up temporary hooks path")
}
}, nil
}