log

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

nolint: gochecknoinits, gochecknoglobals

Index

Constants

View Source
const (
	TraceIDHeader = "X-B3-TraceId"
)

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, fields ...interface{}) context.Context

NewContext creates a new logger with fields.

func NewContextLog

func NewContextLog(ctx context.Context, l *zap.SugaredLogger) context.Context

NewContextLog creates a new logger context from another logger instance.

func NewStructuredLogger

func NewStructuredLogger(logger *zap.SugaredLogger) func(next http.Handler) http.Handler

func SetLevel

func SetLevel(lvl string)

SetLevel dinamically changes the log level.

func WithContext

func WithContext(ctx context.Context) *zap.SugaredLogger

WithContext gets the existing logger from context. If not present returns the default.

Types

type StructuredLogger

type StructuredLogger struct {
	Logger *zap.SugaredLogger
}

func (*StructuredLogger) NewLogEntry

func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry

type StructuredLoggerEntry

type StructuredLoggerEntry struct {
	Logger *zap.SugaredLogger
}

func (*StructuredLoggerEntry) Panic

func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)

func (*StructuredLoggerEntry) Write

func (l *StructuredLoggerEntry) Write(status, bytes int, header http.Header, elapsed time.Duration, extra interface{})

Jump to

Keyboard shortcuts

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