mirror of
https://github.com/labstack/echo.git
synced 2024-12-22 20:06:21 +02:00
5706940bc8
Signed-off-by: Vishal Rana <vr@labstack.com>
1.1 KiB
1.1 KiB
+++ title = "Customization" description = "Customizing Echo" [menu.main] name = "Customization" parent = "guide" weight = 3 +++
HTTP Error Handler
Default HTTP error handler sends an error as JSON with the following rules:
- If error is
Echo#HTTPError
it sends HTTP response with status codeHTTPError.Code
and messageHTTPError.Message
. - If error is
error
it sends HTTP response with status code500 - Internal Server Error
and messageerror.Error()
. - It logs the error.
You can set a custom HTTP error handler using Echo#HTTPErrorHandler
.
Debugging
Echo#Debug
enables/disables debug mode.
Logging
Log Output
Echo#Logger.SetOutput(io.Writer)
sets the output destination for the logger.
Default value os.Stdout
To completely disable logs use Echo#Logger.SetOutput(io.Discard)
or Echo#Logger.SetLevel(log.OFF)
Log Level
Echo#Logger.SetLevel(log.Lvl)
SetLogLevel sets the log level for the logger. Default value OFF
.
Possible values:
DEBUG
INFO
WARN
ERROR
OFF
You can also set a custom logger using Echo#Logger
.