diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-08-22 15:37:45 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-05 08:43:28 +0300 |
commit | 7a20c469ae6468868cda814aa4bc056bbe53eeaa (patch) | |
tree | 44e14ddb0f1495f0ab6d653cbe972d4dab8726fd /internal/testhelper | |
parent | 5c9ed5a5d20b0c93beac30a446a5e1b1394d3dce (diff) |
cmd/gitaly-git2go: Use log writer instead of splicing log outputs
When spawning gitaly-git2go processes, we redirect their stderr to print
to the writer used by our global logging mechanism. This should in the
general case be stderr of the Gitaly process, which means that any logs
would get spliced into the main logging stream generated by Gitaly.
The mechanism isn't great though, and we're about to get rid of the
global logging instance in favor of the injected ones. Given that this
is the last instance where we still rely on the global logger's internal
workings, and that the gitaly-git2go command is going away in a release
or two anyway, there is thus a strong urge to adapt it to unblock our
remaining logging refactorings.
And that's exactly what we do now. Instead of reaching into the global
logging instance to retrieve its writer, we simply construct a writer
from the logger and pass that to the newly created process. Now this has
the downside that we're unable to control the log level, and furthermore
it will cause the log messages themselves to be encoded in JSON again.
But as said, this is only a temporary measure that we can get rid of in
the near future by removing the complete gitaly-git2go command.
This change removes the last instance where we rely on our logger to be
a `logrus.Logger` and is also the last user of `log.Default()`.
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testserver/gitaly.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go index 0b473ea18..6baae7859 100644 --- a/internal/testhelper/testserver/gitaly.go +++ b/internal/testhelper/testserver/gitaly.go @@ -344,7 +344,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) * } if gsd.git2goExecutor == nil { - gsd.git2goExecutor = git2go.NewExecutor(cfg, gsd.gitCmdFactory, gsd.locator) + gsd.git2goExecutor = git2go.NewExecutor(cfg, gsd.gitCmdFactory, gsd.locator, gsd.logger) } if gsd.updaterWithHooks == nil { |