- easiest Zap Logger configuration using yaml-config.
- configuration for environments without code change.
- configuration TCP and UDP Zap Logger sinks out of box.
- minimal code for full-featured Zap Logger initialization.
- Install package:
go install github.com/nafigator/zapper@latest
- Use zapper for Zap Logger initialization:
package main import ( "github.com/nafigator/zapper" "github.com/nafigator/zapper/conf" ) func main() { log := zapper.Must(conf.Must()) log.Info("Zap logger: OK") }
level: info
encoding: console
outputPaths:
- stdout
errorOutputPaths:
- stderr
encoderConfig:
messageKey: message
levelKey: level
timeKey: time
callerKey: line
levelEncoder: capitalColor
timeEncoder:
layout: 2006-01-02 15:04:05.000
durationEncoder: string
callerEncoder: default
For more options see config.example.yml.
By default, package search yaml-config in current dir or in /etc/zap/config.yml
.
This software follows "Semantic Versioning" specifications. The signature of exported package functions is used as a public API. Read more on SemVer.org.