2016-10-20 20:30:53 +02:00
|
|
|
+++
|
|
|
|
title = "Customization"
|
|
|
|
description = "Customizing Echo"
|
|
|
|
[menu.side]
|
|
|
|
name = "Customization"
|
|
|
|
parent = "guide"
|
|
|
|
weight = 3
|
|
|
|
+++
|
|
|
|
|
|
|
|
## Customization
|
|
|
|
|
|
|
|
### HTTP Error Handler
|
|
|
|
|
|
|
|
Default HTTP error handler rules:
|
|
|
|
|
|
|
|
- If error is of type `Echo#HTTPError` it sends HTTP response with status code `HTTPError.Code`
|
|
|
|
and message `HTTPError.Message`.
|
|
|
|
- Else it sends `500 - Internal Server Error`.
|
|
|
|
- If debug mode is enabled, it uses `error.Error()` as status message.
|
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
You can also set a custom HTTP error handler using `Echo#HTTPErrorHandler`.
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
### Debugging
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
`Echo#Debug` enables/disables debug mode.
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
### Logging
|
2016-10-20 20:30:53 +02:00
|
|
|
|
|
|
|
#### Log Output
|
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
`Echo#Logger.SetOutput(io.Writer)` sets the output destination for the logger.
|
|
|
|
Default value `os.Stdout`
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
To completely disable logs use `Echo#Logger.SetOutput(io.Discard)` or `Echo#Logger.SetLevel(log.OFF)`
|
2016-10-20 20:30:53 +02:00
|
|
|
|
|
|
|
#### Log Level
|
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
`Echo#Logger.SetLevel(log.Lvl)`
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
SetLogLevel sets the log level for the logger. Default value `OFF`.
|
2016-10-20 20:30:53 +02:00
|
|
|
Possible values:
|
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
- `DEBUG`
|
|
|
|
- `INFO`
|
|
|
|
- `WARN`
|
|
|
|
- `ERROR`
|
|
|
|
- `OFF`
|
2016-10-20 20:30:53 +02:00
|
|
|
|
2016-11-13 19:36:57 +02:00
|
|
|
You can also set a custom logger using `Echo#Logger`.
|