https://github.com/brpaz/echozap
Middleware for Golang Echo framework that provides integration with Uber´s Zap logging library for logging HTTP requests
https://github.com/brpaz/echozap
echo-framework golang logging middleware
Last synced: 5 months ago
JSON representation
Middleware for Golang Echo framework that provides integration with Uber´s Zap logging library for logging HTTP requests
- Host: GitHub
- URL: https://github.com/brpaz/echozap
- Owner: brpaz
- License: mit
- Created: 2019-09-29T17:14:30.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T12:11:01.000Z (about 2 years ago)
- Last Synced: 2024-06-18T15:35:19.792Z (over 1 year ago)
- Topics: echo-framework, golang, logging, middleware
- Language: Go
- Homepage:
- Size: 12.7 KB
- Stars: 65
- Watchers: 6
- Forks: 24
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# echozap
> Middleware for Golang [Echo](https://echo.labstack.com/) framework that provides integration with Uber´s [Zap](https://github.com/uber-go/zap) logging library for logging HTTP requests.
[](LICENSE)
[](http://commitizen.github.io/cz-cli/)
[](https://github.com/semantic-release/semantic-release?style=for-the-badge)
[](https://github.com/brpaz/echozap/actions)
[](https://www.codacy.com/manual/brpaz/echozap?utm_source=github.com&utm_medium=referral&utm_content=brpaz/echozap&utm_campaign=Badge_Grade)
[](https://www.codacy.com/manual/brpaz/echozap?utm_source=github.com&utm_medium=referral&utm_content=brpaz/echozap&utm_campaign=Badge_Coverage)
## Pre-requisites
* Go with Go modules enabled.
* [Echo v4](https://echo.labstack.com/)
* [Zap](https://github.com/uber-go/zap)
## Usage
```go
package main
import (
"net/http"
"github.com/brpaz/echozap"
"github.com/labstack/echo/v4"
"go.uber.org/zap"
)
func main() {
e := echo.New()
zapLogger, _ := zap.NewProduction()
e.Use(echozap.ZapLogger(zapLogger))
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
})
e.Logger.Fatal(e.Start(":1323"))
}
```
## Logged details
The following information is logged:
* Status Code
* Time
* Uri
* Method
* Hostname
* Remote IP Address
## Todo
* Add more customization options.
## 🤝 Contributing
Contributions, issues and feature requests are welcome!
## Show your support
If this project have been useful for you, I would be grateful to have your support.
Give a ⭐️ to the project, or just:
## Author
👤 **Bruno Paz**
* Website: [https://github.com/brpaz](https://github.com/brpaz)
* Github: [@brpaz](https://github.com/brpaz)
## 📝 License
Copyright © 2019 [Bruno Paz](https://github.com/brpaz).
This project is [MIT](LICENSE) licensed.
