zapz

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = zapcore.EncoderConfig{
	TimeKey:        "ts",
	LevelKey:       "level",
	NameKey:        "logger",
	CallerKey:      "caller",
	MessageKey:     "message",
	StacktraceKey:  "stacktrace",
	LineEnding:     zapcore.DefaultLineEnding,
	EncodeLevel:    zapcore.LowercaseLevelEncoder,
	EncodeTime:     LogzTimeEncoder,
	EncodeDuration: zapcore.SecondsDurationEncoder,
	EncodeCaller:   zapcore.ShortCallerEncoder,
}

DefaultConfig - Message needs to be the message key for hyperdx

Functions

func LogzTimeEncoder

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

LogzTimeEncoder format to time.RFC3339Nano

func New

func New(token string, opts ...Option) (*zap.Logger, error)

func NewLogz

func NewLogz(logz *hyperdx.HyperdxSender, opts ...Option) (*zap.Logger, error)

func WithTraceMetadata added in v1.4.0

func WithTraceMetadata(ctx context.Context, logger *zap.Logger) *zap.Logger

Helper to hook with otel trace

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

An Option configures a Logger.

func SetEncodeConfig

func SetEncodeConfig(c zapcore.EncoderConfig) Option

SetEncodeConfig set the encoder

func SetLevel

func SetLevel(l zapcore.Level) Option

SetLevel set the log level

func SetLogz

func SetLogz(c *hyperdx.HyperdxSender) Option

SetLogz use this logzsender

func SetType

func SetType(ty string) Option

SetType setting log type zap.Field

func SetUrl added in v1.0.1

func SetUrl(url string) Option

func WithDebug

func WithDebug(w io.Writer) Option

WithDebug enables debugging output for log

type Zapz

type Zapz struct {
	// contains filtered or unexported fields
}

Zapz struct for logging

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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