logger

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logger contains util functions to get/set context to q log fields

Index

Constants

View Source
const (
	TraceSampledJsonKey        = "traceSampled"
	TraceIDJsonKey      string = "traceId"
	SpanIDJsonKey       string = "spanId"
)

Variables

View Source
var (
	Logger *zap.Logger
)

Logger that is configured. It is to be used by arbitrary packages when no logger instance has been passed.

Functions

func AddSpanCtx

func AddSpanCtx(ctx context.Context, spanCtx trace.SpanContext) context.Context

AddSpanCtx adds trace details from span context to the given context.

func AddTraceContext

func AddTraceContext(ctx context.Context) context.Context

AddTraceContext adds trace details to the log context.

func FromContext

func FromContext(ctx context.Context) *zap.Logger

FromContext returns a logger from given context. If context has no logger, it uses application default logger initialized in config

func ToContext

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

ToContext adds given logger to given context

Types

This section is empty.

Jump to

Keyboard shortcuts

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