diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-25 10:09:34 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-26 14:11:36 +0300 |
commit | 9612641f50ee5e58f16ceb390eb6fed87c702075 (patch) | |
tree | 3fd7b8b94e438a869b9d8f70153fe0138a244e5e /internal/praefect | |
parent | 531d5205acec6b5160d862ea687c157c07cbcff1 (diff) |
log: Drop `Debugf()` function from `Logger` interface
Next to `Debug()` and related functions our `Logger` interface also
provides `Debugf()` and related functions that takes a formatting string
as well as a set of arguments for it. There are multiple reasons though
why we don't want to expose these functions:
- They do not exist in the `slog` package, which thus causes our own
internal interface to diverge from our desired target solution.
- It is discouraged to put variable data into the message itself.
Instead, callsites are encouraged to add any variable data as
structured log data.
- It often gets abused in contexts where it's not required at all to
call the formatting variant as all we pass in is a static string.
- We have a pending addition of logging functions that also take a
context parameter as input. The formatting family would cause us
to require four more functions that take such a context as input.
Let's remove `Debugf()` in favor of `Debug()`. Most of the existing
callsites are converted to instead use structured logging data.
Diffstat (limited to 'internal/praefect')
-rw-r--r-- | internal/praefect/coordinator.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/praefect/coordinator.go b/internal/praefect/coordinator.go index a95bab79b..e2a8875e4 100644 --- a/internal/praefect/coordinator.go +++ b/internal/praefect/coordinator.go @@ -665,7 +665,7 @@ func streamParametersContext(ctx context.Context) context.Context { func (c *Coordinator) StreamDirector(ctx context.Context, fullMethodName string, peeker proxy.StreamPeeker) (*proxy.StreamParameters, error) { // For phase 1, we need to route messages based on the storage location // to the appropriate Gitaly node. - log.FromContext(ctx).Debugf("Stream director received method %s", fullMethodName) + log.FromContext(ctx).WithField("method", fullMethodName).Debug("Stream director received method") mi, err := c.registry.LookupMethod(fullMethodName) if err != nil { |