Documentation ¶
Overview ¶
Package zaplog provides a constructor for zap.Logger with sensible defaults.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Tee ¶
Tee returns log’s clone that duplicates log entries into another core.
Example ¶
package main import ( "io" "os" "go.uber.org/zap" "go.uber.org/zap/zapcore" "github.com/pact-im/go-pkg/zaplog" ) func main() { lg := zaplog.Tee(zaplog.New(io.Discard).With( // Note that Tee does carry existing context to the target // core since it’s attached to the current core only. zap.String("ignored", "oops"), ), zapcore.NewCore( zapcore.NewConsoleEncoder(zapcore.EncoderConfig{ MessageKey: "msg", LevelKey: "level", EncodeLevel: zapcore.LowercaseLevelEncoder, ConsoleSeparator: ": ", }), zapcore.AddSync(os.Stdout), zap.DebugLevel, )).With(zap.String("shark", "gawr gura")) lg.Debug("cheeki breeki") }
Output: debug: cheeki breeki: {"shark": "gawr gura"}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.