https://github.com/phsym/zeroslog
A zerolog handler for slog
https://github.com/phsym/zeroslog
Last synced: 9 months ago
JSON representation
A zerolog handler for slog
- Host: GitHub
- URL: https://github.com/phsym/zeroslog
- Owner: phsym
- License: mit
- Created: 2023-08-15T14:21:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-23T16:02:10.000Z (almost 2 years ago)
- Last Synced: 2024-12-02T23:18:18.782Z (over 1 year ago)
- Language: Go
- Size: 43 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zeroslog
[](https://pkg.go.dev/github.com/phsym/zeroslog) [](https://raw.githubusercontent.com/phsym/zeroslog/master/LICENSE) [](https://github.com/phsym/zeroslog/actions/workflows/go.yml) [](https://codecov.io/gh/phsym/zeroslog) [](https://goreportcard.com/report/github.com/phsym/zeroslog)
A zerolog handler for slog
## Example
```go
package main
import (
"log/slog"
"github.com/phsym/zeroslog"
)
func main() {
logger := slog.New(
zeroslog.NewJsonHandler(os.Stderr, &zeroslog.HandlerOptions{Level: slog.LevelDebug}),
)
slog.SetDefault(logger)
slog.Info("Hello world!", "foo", "bar")
}
```