fxlogger

package
v0.0.0-...-4ef61cc Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Service = "service"
)

Variables

View Source
var FxEventLogger = func(log *Logger) fxevent.Logger {
	return log
}
View Source
var FxLoggerModule = fx.Module("logger",
	fx.Provide(
		NewDefaultLoggerFactory,
		NewFxLogger,
		fx.Annotate(
			fxloggertest.GetTestLogBufferInstance,
			fx.ResultTags(`name:"test-log-buffer"`),
		),
	),
)

Functions

func FetchLogLevel

func FetchLogLevel(level string) zerolog.Level

Types

type DefaultLoggerFactory

type DefaultLoggerFactory struct{}

func (*DefaultLoggerFactory) Create

func (f *DefaultLoggerFactory) Create(options ...LoggerOption) (*Logger, error)

type FxLoggerParam

type FxLoggerParam struct {
	fx.In
	Factory LoggerFactory
	Config  *fxconfig.Config
}

type Logger

type Logger struct {
	*zerolog.Logger
}

func CtxLogger

func CtxLogger(ctx context.Context) *Logger

func FromZerolog

func FromZerolog(logger zerolog.Logger) *Logger

func NewFxLogger

func NewFxLogger(p FxLoggerParam) (*Logger, error)

func (*Logger) LogEvent

func (l *Logger) LogEvent(event fxevent.Event)

func (*Logger) ToZerolog

func (l *Logger) ToZerolog() *zerolog.Logger

type LoggerFactory

type LoggerFactory interface {
	Create(options ...LoggerOption) (*Logger, error)
}

func NewDefaultLoggerFactory

func NewDefaultLoggerFactory() LoggerFactory

type LoggerOption

type LoggerOption func(o *options)

func WithLevel

func WithLevel(l zerolog.Level) LoggerOption

func WithName

func WithName(n string) LoggerOption

func WithOutputWriter

func WithOutputWriter(w io.Writer) LoggerOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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