diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-14 17:59:12 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-15 13:37:43 +0300 |
commit | 2a006c4ee8b47887ddc1274dab9f645caf679c41 (patch) | |
tree | f8ff40264468d2c643ffad109201f95e1a01fa6c /internal/streamcache | |
parent | 47bcacea13a24cc3712900de3b2039d8efbce7f9 (diff) |
log: Wrap the logrus logger
Introduce a wrapper for the logrus logging infrastructure. This is a
first step towards abstracting away the actual implementation of our
logs behind a type that we can iterate on and will thus pave the way
towards adoption of the `slog` package.
Note that this is only one step of this transition. The interface does
not yet roundtrip to itself, e.g. calling `log.Logger.WithError()` will
result in a `logrus.Entry`, not in a `log.Logger`. This will be handled
at a later point.
Diffstat (limited to 'internal/streamcache')
-rw-r--r-- | internal/streamcache/cache.go | 8 | ||||
-rw-r--r-- | internal/streamcache/filestore.go | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/internal/streamcache/cache.go b/internal/streamcache/cache.go index be16f923a..ad365c2f6 100644 --- a/internal/streamcache/cache.go +++ b/internal/streamcache/cache.go @@ -35,10 +35,10 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/v16/internal/dontpanic" "gitlab.com/gitlab-org/gitaly/v16/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v16/internal/helper" + "gitlab.com/gitlab-org/gitaly/v16/internal/log" ) var ( @@ -132,7 +132,7 @@ type cache struct { createFile func() (namedWriteCloser, error) stop chan struct{} stopOnce sync.Once - logger logrus.FieldLogger + logger log.Logger dir string sleepLoop *dontpanic.Forever @@ -142,7 +142,7 @@ type cache struct { } // New returns a new cache instance. -func New(cfg config.StreamCacheConfig, logger logrus.FieldLogger) Cache { +func New(cfg config.StreamCacheConfig, logger log.Logger) Cache { if cfg.Enabled { packObjectsCacheEnabled.WithLabelValues( cfg.Dir, @@ -165,7 +165,7 @@ func newCacheWithSleep( maxAge time.Duration, filestoreSleep func(time.Duration) <-chan time.Time, cleanSleep func(time.Duration) <-chan time.Time, - logger logrus.FieldLogger, + logger log.Logger, ) *cache { fs := newFilestore(dir, maxAge, filestoreSleep, logger) diff --git a/internal/streamcache/filestore.go b/internal/streamcache/filestore.go index bf9b1b318..4d01e377e 100644 --- a/internal/streamcache/filestore.go +++ b/internal/streamcache/filestore.go @@ -12,9 +12,9 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/v16/internal/dontpanic" "gitlab.com/gitlab-org/gitaly/v16/internal/helper/perm" + "gitlab.com/gitlab-org/gitaly/v16/internal/log" ) var ( @@ -60,7 +60,7 @@ type filestore struct { sleepLoop *dontpanic.Forever } -func newFilestore(dir string, maxAge time.Duration, sleep func(time.Duration) <-chan time.Time, logger logrus.FieldLogger) *filestore { +func newFilestore(dir string, maxAge time.Duration, sleep func(time.Duration) <-chan time.Time, logger log.Logger) *filestore { fs := &filestore{ dir: dir, maxAge: maxAge, |