Skip to content

housekeeping: Inject logger from external

Patrick Steinhardt requested to merge pks-log-housekeeping-inject-logger into master

When logging data, the housekeeping manager will currently extract the logger from its context. It's not guaranteed though that the context will in fact have a logger set up because the functionality is used from two different contexts:

1. From the daily optimization worker, which runs outside of the
   gRPC context and thus may not have a context logger set up.

2. From OptimzeRepository, which does have a gRPC context and thus
   also a context logger.

Let's make the requirement to specify a configured logger explicitly by requiring callers to pass in a logger to the optimizing functions.

While it would be preferable to simply inject the logger into the housekeeping manager directly at initialization time, we would be losing information extract from the context if we did so. We can fix this at a later point though once we have migrated away from ctxlogrus in favor of passing the context to our logging functions explicitly, like is done in the new slog package.

This change also prepares us for some upcoming logging refactorings.

Merge request reports