mirror of
https://github.com/nais/wonderwall.git
synced 2026-05-07 17:06:57 +00:00
26 lines
406 B
Go
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)
|
|
}
|