z

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 2 Imported by: 6

Documentation

Overview

Package z provides an API for structured logging fields by wrapping zap.Field. It also supports internal structured errors.

Index

Constants

This section is empty.

Variables

View Source
var Skip = func(add func(zap.Field)) {}

Skip is a noop wrapped zap field similar to zap.Skip.

Functions

This section is empty.

Types

type Field

type Field func(add func(zap.Field))

Field wraps one or more zap fields.

func Any

func Any(key string, val interface{}) Field

Any returns a wrapped zap string field with the string version of value. Note we are not using zap.Any since logfmt formatter doesn't support it.

func Bool

func Bool(key string, val bool) Field

Bool returns a wrapped zap boolean field.

func Err

func Err(err error) Field

Err returns a wrapped zap error field. It will include an additional stack trace and fields if the error is an internal structured error. Note: This is only used when logging errors on other levels than Error since it has built-in support for errors.

func F64

func F64(key string, val float64) Field

F64 returns a wrapped zap float64 field.

func Hex added in v0.2.0

func Hex(key string, val []byte) Field

Hex returns a wrapped zap hex field.

func I64

func I64(key string, val int64) Field

I64 returns a wrapped zap int64 field.

func Int

func Int(key string, val int) Field

Int returns a wrapped zap int field.

func Str

func Str(key, val string) Field

Str returns a wrapped zap string field.

func U64

func U64(key string, val uint64) Field

U64 returns a wrapped zap uint64 field.

func Uint

func Uint(key string, val uint) Field

Uint returns a wrapped zap uint field.

Jump to

Keyboard shortcuts

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