zap

package
v0.0.0-...-0611383 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package zap sets up a zap.Logger using the Zap logging framework. This implementation contains configurable options including log levels, stack trace levels, encoders, and caller skip levels.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Opts) *zap.Logger

New returns a new zap.Logger configured with the passed Options or their defaults.

func ParseLogLevel

func ParseLogLevel(logLevel string) (zap.AtomicLevel, error)

ParseLogLevel accepts either a capitalized or lower cased string for the log level. Accepts one of "debug", "info", "warn", "error", "panic", or "fatal". Returns zap.InfoLevel on an error.

Types

type Opts

type Opts func(*options)

Opts allows manipulation of the Zap options.

func AddCallerSkip

func AddCallerSkip(skip int) Opts

AddCallerSkip increases the number of callers skipped by caller annotation, supplying this Option prevents zap from always reporting the wrapper code as the caller.

func Encoder

func Encoder(encoder zapcore.Encoder) Opts

Encoder configures how the logger will encode the output e.g console, JSON. See Options.Encoder.

func Level

func Level(level *zap.AtomicLevel) Opts

Level sets the the minimum enabled logging level e.g Debug, Info, Warn, Error. See Options.Level.

func RawOptions

func RawOptions(opts ...zap.Option) Opts

RawOptions allows appending additional zap.Options. See Options.ZapOptions.

func StacktraceLevel

func StacktraceLevel(stacktraceLevel *zap.AtomicLevel) Opts

StacktraceLevel configures the logger to record a stack trace for all messages at or above the given level. See Options.StacktraceLevel.

func WriteTo

func WriteTo(out io.Writer) Opts

WriteTo configures the logger to write to the given io.Writer, instead of stderr. See Options.OutputDest.

Jump to

Keyboard shortcuts

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