Add a standard logger and HTTP logging middleware

Create a standard log object and use dependency injection to pass it to
the broadbandCollector and a new loggingMiddleware for wrapping HTTP
requests to log the request.

Logs are emitted as structured JSON logs by default but can be switched
to a human-friendly output by passing -log.level console.

The Prometheus client_golang library has also been upgraded.
This commit is contained in:
James O'Gorman
2020-11-28 14:38:45 +00:00
parent b8f807c01f
commit cab8f1f626
3 changed files with 406 additions and 14 deletions

5
go.mod
View File

@@ -2,4 +2,7 @@ module github.com/jamesog/aaisp-chaos
go 1.13
require github.com/prometheus/client_golang v1.1.0
require (
github.com/prometheus/client_golang v1.8.0
github.com/rs/zerolog v1.20.0
)