Back to godoc.org
github.com/Unity-Technologies/uzap

Package uzap

v0.2.1
Latest Go to latest

The latest major version is .

Published: Jul 29, 2020 | License: MIT | Module: github.com/Unity-Technologies/uzap

Overview

Package uzap contains basic configuration for go.uber.org/zap, for easy use with 12-factor apps.

Index

func MustZap

func MustZap() func()

MustZap is an ease of use function that replaces zap globals and redirects standard `package log` output to a new zap logger. It returns a deferrable function, for calling zap.Logger.Sync at program termination.

func MustZapWithLevel

func MustZapWithLevel(lvl zapcore.Level) func()

MustZapWithLevel is an ease of use function that replaces zap globals and redirects standard `package log` output to a new zap logger. It returns a deferrable function, for calling zap.Logger.Sync at program termination.

func NewZapLogger

func NewZapLogger(opts *Options) (*zap.Logger, zap.AtomicLevel)

NewZapLogger configures a zap.Logger for use in container based environments ERROR level logs are written to stderr and all other levels are written to stdout Useful in Kubernetes where stderr & stdout are interpreted as ERROR & INFO level logs respectively opts.Debug controls the loggers output. Human readable when true; JSON when false.

type Options

type Options struct {
	Level zapcore.Level // zap defaults to INFO
	Debug bool          // defaults to false, displays human readable output instead of json
}

Options is used to parse environment vars with the log level and optional debug flag.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier