Closed
Description
Initialize klog to NGF logger so that client-go logs become consistent with NGF loggers.
So that we avoid inconsistencies like below:
I0927 21:14:42.702979 7 leaderelection.go:250] attempting to acquire leader lease nginx-gateway/nginx-gateway-leader-election...
{"level":"info","ts":"2023-09-27T21:14:42Z","logger":"statusUpdater","msg":"Skipping updating Gateway API status because not leader"}
{"level":"info","ts":"2023-09-27T21:14:42Z","logger":"statusUpdater","msg":"Skipping updating Nginx Gateway status because not leader"}
I0927 21:15:04.509435 7 leaderelection.go:260] successfully acquired lease nginx-gateway/nginx-gateway-leader-election
{"level":"info","ts":"2023-09-27T21:15:04Z","logger":"leaderElector","msg":"Started leading"}
where some lines are text klog logs, others - structured NGF logs
Acceptance criteria:
- Use https://pkg.go.dev/k8s.io/klog/v2#SetLogger
- Ensure NGF log level works well with klog level
- Update logging guidelines -- https://github.com/nginxinc/nginx-gateway-fabric/blob/main/docs/developer/logging-guidelines.md#external-libraries