Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spirosoik/echo-logrus
A logging middleware for minimal golang Echo framework with logrus
https://github.com/spirosoik/echo-logrus
echo-framework golang logging middleware
Last synced: about 5 hours ago
JSON representation
A logging middleware for minimal golang Echo framework with logrus
- Host: GitHub
- URL: https://github.com/spirosoik/echo-logrus
- Owner: spirosoik
- License: apache-2.0
- Created: 2020-06-20T07:26:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-20T08:59:19.000Z (over 4 years ago)
- Last Synced: 2023-07-27T22:38:28.716Z (over 1 year ago)
- Topics: echo-framework, golang, logging, middleware
- Language: Go
- Size: 9.77 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# echo-logger
A logging middleware for minimal golang Echo framework with logrus## Usage
```go
import (
"net/http""github.com/labstack/echo/v4"
"github.com/sirupsen/logrus"
echologrus "github.com/spirosoik/echo-logrus"
)func main() {
e := echo.New()
logger := logrus.New()
logger.SetLevel(logrus.DebugLevel)// Usage of middleware
mw := echologrus.NewLoggerMiddleware(logger)
e.Logger = mw
e.Use(mw.Hook())e.GET("/", func(c echo.Context) error {
c.Logger().Debug("test") // test logging
c.Logger().Warn("test") // test logging
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":3000"))
}```
There is an example in [_example](_examples/) folder and you can run it:
```bash
# in one terminal
go run _examples/main.go
``````bash
# in second terminal
curl localhost:3000
```# Contributors
[Roel Reijerse](https://github.com/rollulus) Software Engineer