~emersion/drmdb

ref: e081ab2f41e4b3b4c5d53b9fe319bc4827a2564e drmdb/cmd/drmdb/main.go -rw-r--r-- 505 bytes
e081ab2fSimon Ser Tweak logging 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"git.sr.ht/~emersion/drmdb"
	"github.com/labstack/echo/v4/middleware"
	"github.com/labstack/gommon/log"
)

func main() {
	e := drmdb.New()
	e.HideBanner = true
	if l, ok := e.Logger.(*log.Logger); ok {
		l.SetHeader("${time_rfc3339} ${level}")
	}
	e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
		Format: "${time_rfc3339} method=${method}, uri=${uri}, status=${status}, latency=${latency_human}\n",
	}))
	e.Use(middleware.Recover())
	e.Logger.Fatal(e.Start(":1323"))
}