log

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewForTest

func NewForTest(config *logger_config.Logs) (*zapLogger, *observer.ObservedLogs)

NewForTest returns a new logger and the corresponding observed logs which can be used in unit tests to verify log entries.

func NewTmpLogger

func NewTmpLogger() *zapLogger

NewTmpLogger creates a temporary logger if the logger is not yet initialized.

func NewZapLogger

func NewZapLogger(config *logger_config.Logs) *zapLogger

New creates a new logger using the default configuration.

func ResetGlobalLogger

func ResetGlobalLogger()

ResetGlobalLogger resets the global logger for isolated tests.

func SetLogger

func SetLogger(tracer Logger)

Types

type Logger

type Logger interface {
	// With returns a logger based on the root logger and decorates it with the given context and arguments.
	With(ctx context.Context, args ...interface{}) Logger
	Debug(args ...interface{})
	Info(args ...interface{})
	Error(args ...interface{})
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger is a logger that supports log levels, context and structured logging.

func GetLogger

func GetLogger() Logger

func LogFactory

func LogFactory(config *logger_config.Logs) (Logger, error)

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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