Skip to content

repos: fix incorrect logging usage

Administrator requested to merge fix-incorrect-logger into main

Created by: bobheadxi

Scoped is not meant to be used to log log entries. From the docstring of Scoped:

Scoped returns the global logger and sets it up with the given scope and OpenTelemetry compliant implementation. Instead of using this everywhere a log is needed, callers should hold a reference to the Logger and pass it in to places that need to log.

Scopes should be static values, NOT dynamic values like identifiers or parameters, and should generally be CamelCased with descriptions that follow our logging conventions - learn more: https://docs.sourcegraph.com/dev/how-to/add_logging#scoped-loggers

Additionally, as per https://docs.sourcegraph.com/dev/how-to/add_logging#scoped-loggers, structs should hold their own references to loggers. I do not see an obvious instantiation path here, so I just added it on Register for now. Feel free to follow up with a better instantiation path if desired.

Test plan

unit tests

Merge request reports

Loading