zapx: go.bobheadxi.dev/zapx Index | Files | Directories

package zapx

import "go.bobheadxi.dev/zapx"

Index

Package Files

fields.go option.go zapx.go

func FieldSet Uses

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 Uses

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.

type FieldSetMarshaller Uses

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

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

type Option Uses

type Option func(*zap.Config) error

Option denotes an option for the zapx constructor

func OnlyToFile Uses

func OnlyToFile() Option

OnlyToFile removes all other outputs and only writes to file

func WithDebug Uses

func WithDebug(debug bool) Option

WithDebug sets log level to debug if given bool is true

func WithFields Uses

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

WithFields sets initial fields in the configuration

Directories

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

Package zapx imports 6 packages (graph) and is imported by 5 packages. Updated 2019-07-28. Refresh now. Tools for package owners.