Files
wonderwall/pkg/logging/httplog.go
2022-02-10 13:31:58 +01:00

26 lines
406 B
Go

package logging
import (
"github.com/go-chi/httplog"
"github.com/rs/zerolog"
"github.com/nais/wonderwall/pkg/config"
)
func NewHttpLogger(cfg *config.Config) zerolog.Logger {
opts := httplog.Options{
Concise: true,
LogLevel: "info",
}
format := cfg.LogFormat
switch format {
case "json":
opts.JSON = true
default:
opts.JSON = false
}
return httplog.NewLogger("wonderwall", opts)
}