Replace Echo logger with slog. (#67)

* Replace Echo logger with slog.
This commit is contained in:
Mike Stefanello 2024-06-14 21:01:48 -04:00 committed by GitHub
parent 97bef0257e
commit c8a3d64918
14 changed files with 315 additions and 57 deletions

View file

@ -41,6 +41,21 @@ func ExecuteMiddleware(ctx echo.Context, mw echo.MiddlewareFunc) error {
return handler(ctx)
}
// ExecuteHandler executes a handler with an optional stack of middleware
func ExecuteHandler(ctx echo.Context, handler echo.HandlerFunc, mw ...echo.MiddlewareFunc) error {
return ExecuteMiddleware(ctx, func(next echo.HandlerFunc) echo.HandlerFunc {
return func(ctx echo.Context) error {
run := handler
for _, w := range mw {
run = w(run)
}
return run(ctx)
}
})
}
// AssertHTTPErrorCode asserts an HTTP status code on a given Echo HTTP error
func AssertHTTPErrorCode(t *testing.T, err error, code int) {
httpError, ok := err.(*echo.HTTPError)