diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-21 13:15:10 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-21 14:27:36 +0300 |
commit | e52fdb6a6f09a1cfe7192272a7aabff0d7c84c4b (patch) | |
tree | 2e0598aacf334f3eb0afe3ce124590b715eb2766 /internal/cache | |
parent | 2fd12987428f5f7b69d31253b86c1749e4a5935c (diff) |
log: Simplify Debug et al to accept single argument only
The functions `Debug()`, `Info()` and related accept multiple arguments.
The first hunch would be that the logger would format those arguments
via a call to `fmt.Sprintf()`, and that's seemingly also the assumption
that many of our callsites had. But in fact, the logrus logger will call
`fmt.Sprint()`, which joins the arguments by spaces when neither of the
arguments is a string.
While not being obvious, the current definition also conflicts with the
`slog` package. While the respective functions there also accept a
variable number of arguments, they will instead be interpreted as key
value pairs of structured data.
Let's simplify our calling conventions such that the functions only
accept a single message parameter and adjust callsites that misused
these functions accordingly. This fixes a source of misformatted log
messages and prepares us for the conversion to the `slog` package.
Diffstat (limited to 'internal/cache')
-rw-r--r-- | internal/cache/walker.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/cache/walker.go b/internal/cache/walker.go index aed509046..17d668f71 100644 --- a/internal/cache/walker.go +++ b/internal/cache/walker.go @@ -117,7 +117,7 @@ func (c *DiskCache) walkLoop(walkPath string) { } if err := c.cleanWalk(walkPath); err != nil { - logger.Error(err) + logger.WithError(err).Error("disk cache cleanup failed") } select { |