logger

package
v0.0.0-...-34ec42c Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package logger contains logger implementation

Index

Constants

View Source
const LoggerKey keyLogger = 0

LoggerKey is the key used to retrieve the logger value from the request context.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	With(args ...any) Logger

	WithoutCaller() Logger

	Debug(args ...any)

	// Info uses fmt.Sprint to construct and log a message at INFO level
	Info(args ...any)

	// Error uses fmt.Sprint to construct and log a message at ERROR level
	Error(args ...any)

	// Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
	Fatal(args ...any)

	// Debugf uses fmt.Sprintf to construct and log a message at DEBUG level
	Debugf(format string, args ...any)

	// Infof uses fmt.Sprintf to construct and log a message at INFO level
	Infof(format string, args ...any)

	// Errorf uses fmt.Sprintf to construct and log a message at ERROR level
	Errorf(format string, args ...any)

	// Fatalf uses fmt.Sprintf to construct and log a message, then calls os.Exit.
	Fatalf(format string, args ...any)

	Warn(args ...any)
}

Logger is an interface that describes all the capabilities of the application's logger.

func FromContext

func FromContext(ctx context.Context) Logger

FromContext returns a logger from context. If none found, instantiate a new logger.

func New

func New() Logger

New creates a new logger using the default configuration.

func NewSugar

func NewSugar(l *zap.Logger) Logger

NewSugar returns a SugaredLogger and implements the Logger interface.

func NewTestLogger

func NewTestLogger() (Logger, *observer.ObservedLogs)

NewTestLogger returns a test logger with observability capabilities.

Jump to

Keyboard shortcuts

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