zaputil

package
v0.7.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EncoderConfig = zapcore.EncoderConfig{

	MessageKey:     "message",
	LevelKey:       "severity",
	TimeKey:        "timestamp",
	NameKey:        "logger",
	CallerKey:      "caller",
	StacktraceKey:  "stacktrace",
	LineEnding:     zapcore.DefaultLineEnding,
	EncodeLevel:    EncodeLevel,
	EncodeTime:     RFC3339NanoTimeEncoder,
	EncodeDuration: zapcore.SecondsDurationEncoder,
	EncodeCaller:   zapcore.ShortCallerEncoder,
}

encoderConfig is the default encoder configuration, slightly tweaked to use the correct fields for Stackdriver to parse them.

Functions

func EncodeLevel

func EncodeLevel(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

EncodeLevel maps the internal Zap log level to the appropriate Stackdriver level.

func GRPCZapLogger

func GRPCZapLogger(logger log.Logger) (*zap.Logger, error)

GRPCZapLogger returns *zap.Logger from salt/log.Logger. if error, returns a new *zap.Logger instance

func InitLogger added in v0.6.7

func InitLogger(serviceName string, logLevel string, isGCPCompatible bool) log.Logger

func RFC3339NanoTimeEncoder

func RFC3339NanoTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

RFC3339NanoTimeEncoder serializes a time.Time to an RFC3339Nano-formatted string with nanoseconds precision.

func ServiceContext

func ServiceContext(name string) zap.Field

ServiceContext adds the correct service information adding the log line It is a required field if an error needs to be reported. See Service context and formatting error message

Types

This section is empty.

Jump to

Keyboard shortcuts

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