gcpzap

package
v0.0.0-...-31e8f30 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package gcpzap configures the Uber zap logging library for Google Cloud.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProduction

func NewProduction(opts ...zap.Option) (*zap.Logger, error)

NewProduction wraps zap.NewProduction with configuration that works on Google Cloud.

func NewProductionConfig

func NewProductionConfig() zap.Config

NewProductionConfig wraps zap.NewProductionConfig with configuration that works on Google Cloud.

func WithTrace

func WithTrace(
	logger *zap.SugaredLogger, tracer *gcplogs.Tracer, r *http.Request,
) *zap.SugaredLogger

WithTrace returns a *zap.SugaredLogger that will use the trace ID from r, if it is set.

func WithTraceCore

func WithTraceCore(logger *zap.Logger, tracer *gcplogs.Tracer, r *http.Request) *zap.Logger

WithTraceCore returns a *zap.Logger that will use the trace ID from r, if it is set.

Types

type Tracer

type Tracer struct {
	gcplogs.Tracer
	Logger *zap.Logger
}

Tracer wraps a *zap.Logger to set trace IDs in log messages, if available.

func (*Tracer) FromRequest

func (t *Tracer) FromRequest(r *http.Request) *zap.Logger

FromRequest returns a *zap.Logger that will use the trace ID from r, if it is set.

Jump to

Keyboard shortcuts

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