~emersion/drmdb

ref: 09fb82de3ecc5a42a61fbb6bf71029d6a45c8e8a drmdb/cmd/drmdb/main.go -rw-r--r-- 505 bytes
09fb82deSimon Ser Fix format/modifier pretty-printing 8 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"))
}