tracelog

package module
v0.0.0-...-8625573 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 9 Imported by: 4

README

tracelog

OpenTelemetry Log Correlation with Uber Zap Logging interface

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LoggerOption

type LoggerOption func(*TraceLogger)

func WithLogger

func WithLogger(lg *zap.Logger) LoggerOption

WithLogger sets the base logger to use in the TraceLogger.

type TraceLogger

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

A TraceLogger wraps the base Logger functionality in logic to tag and correlate OpenTelemtry data with the associated log entries.

func NewLogger

func NewLogger(opts ...LoggerOption) *TraceLogger

NewLogger instaniates a new instance our of logger.

func (*TraceLogger) DPanic

func (tl *TraceLogger) DPanic(msg string, args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func (*TraceLogger) Debug

func (tl *TraceLogger) Debug(msg string, args ...interface{})

Debug uses fmt.Sprint to construct and log a message.

func (*TraceLogger) Error

func (tl *TraceLogger) Error(msg string, args ...interface{})

Error uses fmt.Sprint to construct and log a message.

func (*TraceLogger) Fatal

func (tl *TraceLogger) Fatal(msg string, args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (*TraceLogger) FromRequest

func (tl *TraceLogger) FromRequest(r *http.Request) *TraceLogger

FromRequest retrieves any HTTP Headers on the provided request and associates the current TraceLogger's `context.Context`.

func (*TraceLogger) Info

func (tl *TraceLogger) Info(msg string, args ...interface{})

Info uses fmt.Sprint to construct and log a message.

func (*TraceLogger) Named

func (tl *TraceLogger) Named(name string) *TraceLogger

Named adds a sub-scope to the logger's name. See Logger.Named for details.

func (*TraceLogger) Panic

func (tl *TraceLogger) Panic(msg string, args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (*TraceLogger) SetContext

func (tl *TraceLogger) SetContext(ctx context.Context) *TraceLogger

SetContext associates the `context.Context` in use with the instance of our logger.

func (*TraceLogger) Sync

func (tl *TraceLogger) Sync() error

Sync flushes any buffered log entries.

func (*TraceLogger) Warn

func (tl *TraceLogger) Warn(msg string, args ...interface{})

Warn uses fmt.Sprint to construct and log a message.

func (*TraceLogger) With

func (tl *TraceLogger) With(args ...zap.Field) *TraceLogger

With adds a variadic number of fields to the logging context. It accepts a mix of strongly-typed Field objects.

func (*TraceLogger) WithRequest

func (tl *TraceLogger) WithRequest(ctx context.Context, r *http.Request) *http.Request

WithRequest tags the outgoing `http.Request` with HTTP Headers to associate any downstream tracing with the provided `context.Context`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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