Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CopyTime controls whether the time field from zap is copied to zerolog. // The time will be placed in [zerolog.TimestampFieldName]. CopyTime = true // CopyStack controls whether the stack field from zap (if present) is copied to zerolog. // The stack string will be placed in [zerolog.ErrorStackFieldName]. CopyStack = true // CopyCaller controls whether the caller field from zap (if present) is copied to zerolog. // The caller info will be placed in [zerolog.CallerFieldName] after being marshaled using [zerolog.CallerMarshalFunc]. CopyCaller = true )
Functions ¶
func New ¶
New creates a new zapcore.Core using the given zerolog instance.
Example ¶
package main import ( "os" "github.com/rs/zerolog" "go.uber.org/zap" "go.mau.fi/zerozap" ) func main() { zlog := zerolog.New(os.Stdout) zaplog := zap.New(zerozap.New(zlog)) zaplog.Info("Hello, world!") }
Output: {"level":"info","message":"Hello, world!"}
func Option ¶
Option creates a zap.Option that will replace the core of an existing zap logger with a ZeroZap core.
Example ¶
package main import ( "os" "github.com/rs/zerolog" "go.uber.org/zap" "go.mau.fi/zerozap" ) func main() { zlog := zerolog.New(os.Stdout) zaplog := zap.NewNop() zaplog.Info("This is not logged") zaplog = zaplog.WithOptions(zerozap.Option(zlog)) zaplog.Info("This is logged") }
Output: {"level":"info","message":"This is logged"}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.