Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chanchal1987/zaphandler
zaphandler will help to create slog handler using zap logger
https://github.com/chanchal1987/zaphandler
go golang logger-middleware logging logging-library zap
Last synced: about 2 months ago
JSON representation
zaphandler will help to create slog handler using zap logger
- Host: GitHub
- URL: https://github.com/chanchal1987/zaphandler
- Owner: chanchal1987
- License: mit
- Created: 2022-11-04T18:42:50.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-06-11T14:00:26.000Z (over 1 year ago)
- Last Synced: 2024-08-04T10:03:03.901Z (5 months ago)
- Topics: go, golang, logger-middleware, logging, logging-library, zap
- Language: Go
- Homepage:
- Size: 34.2 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-slog - zaphandler
README
# zaphandler
zaphandler will help to create [slog handler](https://pkg.go.dev/log/slog#Handler) using [zap logger](https://pkg.go.dev/go.uber.org/zap) [![Go Reference](https://pkg.go.dev/badge/go.mrchanchal.com/zaphandler.svg)](https://pkg.go.dev/go.mrchanchal.com/zaphandler) [![Report Card](https://goreportcard.com/badge/go.mrchanchal.com/zaphandler)](https://goreportcard.com/report/go.mrchanchal.com/zaphandler)
## Example:
package main
import (
"log/slog""go.mrchanchal.com/zaphandler"
"go.uber.org/zap"
)func main() {
zapL, _ := zap.NewDevelopment()
defer zapL.Sync()logger := slog.New(zaphandler.New(zapL))
logger.Info("sample log message", "field1", "value1", "field2", 33)
}[Go Playground](https://go.dev/play/p/R57ypgVRB8c?v=gotip)