https://github.com/secondtruth/go-logger-zap
📖 zap implementation of the Go Logger interface
https://github.com/secondtruth/go-logger-zap
interface interoperability logging zap
Last synced: 8 months ago
JSON representation
📖 zap implementation of the Go Logger interface
- Host: GitHub
- URL: https://github.com/secondtruth/go-logger-zap
- Owner: secondtruth
- License: mit
- Created: 2024-01-20T15:48:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-10T16:54:03.000Z (about 2 years ago)
- Last Synced: 2025-06-19T01:08:03.853Z (8 months ago)
- Topics: interface, interoperability, logging, zap
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Go Logger interface – zap implementation
This library provides an implementation of the [Logger interface](https://github.com/secondtruth/go-logger)
for [zap](https://github.com/uber-go/zap).
## Installation
To install `go-logger-zap`, use the following command:
go get -u github.com/secondtruth/go-logger-zap
## Quick Start
```go
package main
import (
"os"
zaplogger "github.com/secondtruth/go-logger-zap/logger"
"github.com/secondtruth/go-logger/logger"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
func main() {
consoleEncoder := zapcore.NewJSONEncoder(zap.NewDevelopmentEncoderConfig())
core := zapcore.NewCore(consoleEncoder,
zapcore.Lock(zapcore.AddSync(os.Stderr)),
zapcore.DebugLevel)
zapLog := zap.New(core)
log, _ := zaplogger.NewZapLogger(zapLog)
log.WithFields(logger.Fields{
"foo": "bar",
}).Info("message")
}
```