zaplogutil

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package zaplogutil provides reusable utilities for working with ZAP logger.

Index

Constants

View Source
const PreciseLayout = "2006-01-02T15:04:05.000000Z07:00"

PreciseLayout is a variant of time.RFC3339Nano but with microsecond precision and trailing zeroes.

Variables

This section is empty.

Functions

func Clock

func Clock() zapcore.Clock

Clock is an implementation of zapcore.Clock that uses clock.Now().

func NewStdConsoleEncoder added in v0.11.0

func NewStdConsoleEncoder(ec StdConsoleEncoderConfig) zapcore.Encoder

NewStdConsoleEncoder returns standardized console encoder which is optimized for performance.

func PreciseTimeEncoder

func PreciseTimeEncoder() zapcore.TimeEncoder

PreciseTimeEncoder encodes the time as RFC3389 with 6 digits of sub-second precision.

func TimezoneAdjust

func TimezoneAdjust(inner zapcore.TimeEncoder, isLocal bool) zapcore.TimeEncoder

TimezoneAdjust returns zapcore.TimeEncoder that adjusts the time to either UTC or local time before logging.

Types

type StdConsoleEncoderConfig added in v0.11.0

type StdConsoleEncoderConfig struct {
	TimeLayout         string
	LocalTime          bool
	EmitLoggerName     bool
	EmitLogLevel       bool
	DoNotEmitInfoLevel bool
	ColoredLogLevel    bool
}

StdConsoleEncoderConfig provides configurationfor NewStdConsoleEncoder.

Jump to

Keyboard shortcuts

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