logging

package
v2.25.8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"logging",
	fx.Provide(
		New,
	),
)

Functions

func SetupLogging

func SetupLogging(env env.Environment, loglevel Level)

SetupLogging sets up logging for the environment and the default log level

func WithLogger added in v2.2.1

func WithLogger(entry *logrus.Entry) fx.Option

Types

type Level

type Level string
const (
	TraceLevel Level = "trace"
	DebugLevel Level = "debug"
	InfoLevel  Level = "info"
	WarnLevel  Level = "warn"
	ErrorLevel Level = "error"
	FatalLevel Level = "fatal"
)

type Logger

type Logger interface {
	Trace(args ...any)
	Tracef(format string, args ...any)

	Debug(args ...any)
	Debugf(format string, args ...any)

	Info(args ...any)
	Infof(format string, args ...any)

	Warn(args ...any)
	Warnf(format string, args ...any)

	Error(args ...any)
	Errorf(format string, args ...any)

	Fatal(args ...any)
	Fatalf(format string, args ...any)

	Printf(format string, args ...any)

	WithTime(t time.Time) Logger
	WithContext(ctx context.Context) Logger
	WithError(err error) Logger
	WithField(key string, value any) Logger
	WithFields(fields ...any) Logger
}

func New

func New(env env.Environment, loglevel Level) (Logger, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳