diff --git a/main.go b/main.go index 23be0aa..41adc80 100644 --- a/main.go +++ b/main.go @@ -58,6 +58,7 @@ func main() { app := echo.New() app.Logger.SetLevel(log.INFO) + log.SetLevel(log.INFO) app.Use(middleware.RecoverWithConfig(middleware.RecoverConfig{ StackSize: 1 << 10, @@ -69,6 +70,7 @@ func main() { Format: "${time_custom} ${method} ${uri} ---> ${status} in ${latency_human} (${bytes_out} bytes)\n", CustomTimeFormat: TimeFormat, })) + log.SetHeader("${time_rfc3339} ${level}") app.Use(middleware.RemoveTrailingSlash()) app.OnAddRouteHandler = func(host string, route echo.Route, handler echo.HandlerFunc, middleware []echo.MiddlewareFunc) { @@ -141,6 +143,14 @@ func main() { return c.NoContent(http.StatusOK) })) + app.GET("/locked", authed(func(c echo.Context) error { + mut.Lock() + l := locked + mut.Unlock() + + return c.JSON(http.StatusOK, l) + })) + app.POST("/lock", authed(func(c echo.Context) error { mut.Lock() locked = true