zapx

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MIT Imports: 6 Imported by: 0

README

zapx

Extensions for uber-go/zap, a structured logging library for Go.

GoDoc Build Status Go Report Card Sourcegraph for Repo Reference Count

Usage

go get -u github.com/bobheadxi/zapx

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FieldSet added in v0.3.0

func FieldSet(key string, fields ...zap.Field) zap.Field

FieldSet allows logging of sets of fields as a log object TODO: not as performant as testdata.Obj for some reason, need to look into why

func New

func New(logpath string, dev bool, opts ...Option) (l *zap.Logger, err error)

New creates a default zap logger based with basic defaults. If `logpath` is set, will use json encoder and write to the provided filepath. If `dev` is true, will use zap.DevelopmentConfig with colors enabled, though if logpath is set, the json encoder (without colors) will be enforced. If `dev` is false, will use zap.ProductionConfig.

Types

type FieldSetMarshaller added in v0.3.0

type FieldSetMarshaller interface {
	zapcore.ObjectMarshaler
	Fields() []zap.Field
}

FieldSetMarshaller is the underlying type used by zapx.Fields()

type Option added in v0.3.0

type Option func(*zap.Config) error

Option denotes an option for the zapx constructor

func OnlyToFile added in v0.3.0

func OnlyToFile() Option

OnlyToFile removes all other outputs and only writes to file

func WithFields added in v0.3.0

func WithFields(fields map[string]interface{}) Option

WithFields sets initial fields in the configuration

Directories

Path Synopsis
Package zgcp provides log extensions and hooks for Google Cloud Platform services.
Package zgcp provides log extensions and hooks for Google Cloud Platform services.
Package zgql provides zap extensions and middleware for `99designs/gqlgen` (https://github.com/99designs/gqlgen).
Package zgql provides zap extensions and middleware for `99designs/gqlgen` (https://github.com/99designs/gqlgen).
Package zhttp provides zap extensions and middleware for Go's HTTP standard library.
Package zhttp provides zap extensions and middleware for Go's HTTP standard library.
Package zpgx provides zap extensions for `jackc/pgx` (https://godoc.org/github.com/jackc/pgx).
Package zpgx provides zap extensions for `jackc/pgx` (https://godoc.org/github.com/jackc/pgx).
Package ztest provides zap utilities for testing.
Package ztest provides zap utilities for testing.

Jump to

Keyboard shortcuts

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