Customization
Echo exposes a set of fields on the Echo instance that let you replace built-in
behavior with your own implementations.
Logging
Section titled “Logging”Echo#Logger writes structured logs. The default handler emits JSON to os.Stdout.
Custom logger
Section titled “Custom logger”The logger is an *slog.Logger, so you can register any slog handler:
e.Logger = slog.New(slog.NewJSONHandler(os.Stdout, nil))Validator
Section titled “Validator”Echo#Validator registers a validator for request payload validation.
Custom binder
Section titled “Custom binder”Echo#Binder registers a custom binder for binding request payloads.
Custom JSON serializer
Section titled “Custom JSON serializer”Echo#JSONSerializer registers a custom JSON serializer. See DefaultJSONSerializer
in json.go.
Renderer
Section titled “Renderer”Echo#Renderer registers a renderer for template rendering.
HTTP error handler
Section titled “HTTP error handler”Echo#HTTPErrorHandler registers a custom HTTP error handler.
Route callback
Section titled “Route callback”Echo#OnAddRoute registers a callback invoked whenever a new route is added to the
router.
IP extractor
Section titled “IP extractor”Echo#IPExtractor controls how the real client IP address is determined. To
retrieve it reliably and securely, your application must be aware of your entire
infrastructure.