Skip to content

Enforce snake case naming convention for log keys

João Pereira requested to merge make-logging-keys-uniform into add-labkit-logging

Related to #31 (closed).

This MR applies the snake case notation to all custom structured logging keys. So far we were mostly using words separated by a dot (e.g. instance.id), which matches the name of each value stored in the context.Context passed around with every request.

It's easier and safer to do this by replacing all dot characters with an underscore when creating a logger rather than changing all keys that are stored in the context. The latter would be riskier and more difficult, as there is logic to parse and dynamically generate some of these (such as for the mux request variables, here). Given that this transformation is run only once per logger and key names are static and short, there are no performance concerns.

Edited by João Pereira

Merge request reports

Loading