logger

package
v0.0.0-...-b19cdf9 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogPrefix

func WithLogPrefix(ctx context.Context, prefix string) context.Context

WithLogPrefix returns a new context with a Logger that has the given prefix using LoggerWithPrefix.

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger injects an additional logger into ctx.

func WithSilent

func WithSilent(ctx context.Context) context.Context

WithSilent returns a context.Context with a no-op logger.

Types

type Logger

type Logger struct {
	*log.Logger
}

Logger is a wrapper around the stdlib Logger.

func Default

func Default() *Logger

Default returns the default logger.

func FromContext

func FromContext(ctx context.Context, prefixes ...string) *Logger

FromContext returns the Logger instance from the ctx, or log.Default() if none.

func New

func New(w io.Writer, flags int) *Logger

New creates a new Logger with the given writer and flags.

func NewWithPrefix

func NewWithPrefix(w io.Writer, prefix string, flags int) *Logger

NewWithPrefix creates a new Logger with the given prefix appended.

func Silent

func Silent() *Logger

Silent returns a no-op logger.

func (*Logger) WithPrefix

func (l *Logger) WithPrefix(prefix string) *Logger

Jump to

Keyboard shortcuts

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