Logger middleware

Echo comes with a community developed logger middleware that you are able to use within your web application. This middleware takes every request received by the application and logs metadata about the connection. Items logged include the timestamp, request method, request path, and the duration of the request. In order to implement this helpful middleware within your application, you can use the echo.Use method on the Echo framework instance, as seen in the following code, which is taken from $GOPATH/src/github.com/PacktPublishing/Echo-Essentials/chapter6/cmd/service/main.go:

e.Use(middleware.Logger())

By using the preceding middleware, you will get the following log messages for each request that comes into your server. ...

Get Echo Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.