https://github.com/weastur/resty-zerolog
A simple wrapper for zerolog to use it as an implementation of Logger for Resty
https://github.com/weastur/resty-zerolog
golang logging resty zerolog
Last synced: over 1 year ago
JSON representation
A simple wrapper for zerolog to use it as an implementation of Logger for Resty
- Host: GitHub
- URL: https://github.com/weastur/resty-zerolog
- Owner: weastur
- License: mpl-2.0
- Created: 2025-03-23T12:20:22.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-23T17:11:27.000Z (over 1 year ago)
- Last Synced: 2025-03-23T18:22:20.191Z (over 1 year ago)
- Topics: golang, logging, resty, zerolog
- Language: Makefile
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Security: SECURITY.md
- Authors: AUTHORS
Awesome Lists containing this project
README
# resty-zerolog
[](https://goreportcard.com/report/github.com/weastur/resty-zerolog)
[](https://codecov.io/gh/weastur/resty-zerolog)
[](https://github.com/weastur/resty-zerolog/actions/workflows/test.yaml)
[](https://github.com/weastur/resty-zerolog/actions/workflows/lint.yaml)
[](https://github.com/weastur/resty-zerolog/actions/workflows/gitlint.yaml)
[](https://results.pre-commit.ci/latest/github/weastur/resty-zerolog/main)




**resty-zerolog** is a simple wrapper for zerolog to use it as an implementation of
[Logger](https://pkg.go.dev/github.com/go-resty/resty/v3#Logger) interface from [Resty](https://resty.dev/)
## Why?
I wanted to use [zerolog](https://github.com/rs/zerolog) as a logger for [Resty](https://resty.dev/),
but Resty does not support zerolog out of the box. So I created this simple wrapper.
Yes, [Logger](https://pkg.go.dev/github.com/go-resty/resty/v3#Logger) interface from Resty is very simple,
and you can implement it in a few lines of code,
but I wanted to have a ready-to-use solution to **not repeat myself** in every project I use resty and zerolog.
## Installation
```bash
go get -u github.com/weastur/resty-zerolog
```
## Usage
```go
import (
"github.com/rs/zerolog/log"
restyzerolog "github.com/weastur/resty-zerolog"
"resty.dev/v3"
)
client := resty.New()
client.SetLogger(restyzerolog.New(log.Logger))
```
Despite it's extremely simple, you can refer to the [example](./_example/) and
[godoc](https://pkg.go.dev/github.com/weastur/resty-zerolog) to see a bit more.
## Security
Refer to the [SECURITY.md](SECURITY.md) file for more information.
## License
Mozilla Public License 2.0
Refer to the [LICENSE](LICENSE) file for more information.