log

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 3 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterInitAction

func RegisterInitAction(initAction InitAction)

func RegisterShutdownAction

func RegisterShutdownAction(shutdownAction Action)

func ShutdownLogger

func ShutdownLogger() error

func StartLogger

func StartLogger() error

func TransferLogLevel

func TransferLogLevel(logLevel string) slog.Level

Types

type Action added in v1.0.2

type Action func(context context.Context) error

type CoreLogger

type CoreLogger interface {
	Debug(context.Context, string, ...any)
	Info(context.Context, string, ...any)
	Warn(context.Context, string, ...any)
	Error(context.Context, string, ...any)
	DebugContext(string, ...any)
	InfoContext(string, ...any)
	WarnContext(string, ...any)
	ErrorContext(string, ...any)
}

func Default

func Default() CoreLogger

func Logger

func Logger() CoreLogger

type DefaultLogger

type DefaultLogger struct {
	Logger *slog.Logger
}

func GetDefaultLogger

func GetDefaultLogger() *DefaultLogger

func (*DefaultLogger) Debug

func (l *DefaultLogger) Debug(ctx context.Context, msg string, args ...any)

func (*DefaultLogger) DebugContext

func (l *DefaultLogger) DebugContext(msg string, args ...any)

func (*DefaultLogger) Error

func (l *DefaultLogger) Error(ctx context.Context, msg string, args ...any)

func (*DefaultLogger) ErrorContext

func (l *DefaultLogger) ErrorContext(msg string, args ...any)

func (*DefaultLogger) Info

func (l *DefaultLogger) Info(ctx context.Context, msg string, args ...any)

func (*DefaultLogger) InfoContext

func (l *DefaultLogger) InfoContext(msg string, args ...any)

func (*DefaultLogger) Warn

func (l *DefaultLogger) Warn(ctx context.Context, msg string, args ...any)

func (*DefaultLogger) WarnContext

func (l *DefaultLogger) WarnContext(msg string, args ...any)

type InitAction

type InitAction func(context.Context) (CoreLogger, error)

Jump to

Keyboard shortcuts

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