Documentation
¶
Index ¶
Constants ¶
const (
Debug = 1
)
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext returns a logr.Logger from the context or an instance of the global logger
func FromContextWithTrace ¶
FromContextWithTrace returns a logr.Logger from the context, enriched with traceId and spanId if available
func ZapProto ¶
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.