Files
wonderwall/pkg/logging/httplog.go
sindrerh2 fb4adc9cc5 feat: add templated error page
Co-authored-by: Trong Huu Nguyen <trong.huu.nguyen@nav.no>
2021-10-05 14:09:09 +02: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: "warn",
}
format := cfg.LogFormat
switch format {
case "json":
opts.JSON = true
default:
opts.JSON = false
}
return httplog.NewLogger("wonderwall", opts)
}