log

package
v0.0.0-...-f01a8c1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SamplingInitial    = 100
	SamplingThereafter = 100
)

Logging constants and defaults

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextLoggerKey

type ContextLoggerKey string

ContextLoggerKey is the type of context key used to store the logger in the context

const ContextLogger ContextLoggerKey = "ContextLogger"

ContextLogger is the key used to store the logger in the context

type Logger

type Logger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

Logger instance for logging

func Get

func Get(ctx context.Context, opts ...zap.Option) (context.Context, Logger)

Get returns logger if already initialized or creates and returns logger if not initialized

func New

func New(_ context.Context, opts ...zap.Option) (Logger, error)

New initializes a new logger

func WithTrace

func WithTrace(ctx context.Context, operation string) (context.Context, Logger)

WithTrace returns a logger with trace span initialized with an operation name

func (Logger) Sync

func (l Logger) Sync()

func (Logger) With

func (l Logger) With(fields ...zap.Field) Logger

With returns a new logger with additional fields

Jump to

Keyboard shortcuts

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