logs

package
v3.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug = 1
)

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) logr.Logger

FromContext returns a logr.Logger from the context or an instance of the global logger

func FromContextWithTrace

func FromContextWithTrace(ctx context.Context) logr.Logger

FromContextWithTrace returns a logr.Logger from the context, enriched with traceId and spanId if available

func NewLogger

func NewLogger() logr.Logger

func ZapProto

func ZapProto(key string, pb proto.Message) zap.Field

ZapProto is a helper function to be able to log protos as JSON objects. We want protos to be logged using the proto json format so we can deserialize them from the logs. If you just log a proto with zap it will use the json serialization of the GoLang struct which will not match the proto json format. So we serialize the request to JSON and then deserialize it to a map so we can log it as a JSON object. A more efficient solution would be to use https://github.com/kazegusuri/go-proto-zap-marshaler to generate a custom zapcore.ObjectMarshaler implementation for each proto message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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