From e52fdb6a6f09a1cfe7192272a7aabff0d7c84c4b Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 21 Sep 2023 12:15:10 +0200 Subject: 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. --- internal/cache/walker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/cache') 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 { -- cgit v1.2.3