Skip to content

Customization

Echo exposes a set of fields on the Echo instance that let you replace built-in behavior with your own implementations.

Echo#Logger writes structured logs. The default handler emits JSON to os.Stdout.

The logger is an *slog.Logger, so you can register any slog handler:

e.Logger = slog.New(slog.NewJSONHandler(os.Stdout, nil))

Echo#Validator registers a validator for request payload validation.

Learn more

Echo#Binder registers a custom binder for binding request payloads.

Learn more

Echo#JSONSerializer registers a custom JSON serializer. See DefaultJSONSerializer in json.go.

Echo#Renderer registers a renderer for template rendering.

Learn more

Echo#HTTPErrorHandler registers a custom HTTP error handler.

Learn more

Echo#OnAddRoute registers a callback invoked whenever a new route is added to the router.

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.

Learn more