zapx

package module
v0.0.0-...-ea697e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2021 License: Apache-2.0 Imports: 2 Imported by: 1

README

Package zapx implements companion functions for go.uber.org/zap

GoDoc

Documentation

Overview

Package zapx implements companion functions for go.uber.org/zap.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func G

func G(name string, field ...zap.Field) zap.Field

G returns the named group of zap.Field.

Example
log := zap.NewExample()
log.Info(
	"example of using group",
	zapx.G(
		"groupA",
		zap.String("name", "alice"),
		zap.Int("star", 42),
	),
)
Output:

{"level":"info","msg":"example of using group","groupA":{"name":"alice","star":42}}

Types

type Fields

type Fields []zap.Field

Fields is []zap.Field that has the method MarshalLogObject(zapcore.ObjectEncoder) error.

func (Fields) MarshalLogObject

func (fs Fields) MarshalLogObject(enc zapcore.ObjectEncoder) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL