logger

package
v0.1.143 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReflectTypeILogger = di.GetInterfaceReflectType((*ILogger)(nil))

ReflectTypeILogger used when your service claims to implement ILogger

Functions

func AddScopedILogger

func AddScopedILogger(builder *di.Builder, implType reflect.Type)

AddScopedILogger adds a type that implements ILogger

func AddScopedILoggerByFunc

func AddScopedILoggerByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddScopedILoggerByFunc adds a type by a custom func

func AddSingletonILogger

func AddSingletonILogger(builder *di.Builder, implType reflect.Type)

AddSingletonILogger adds a type that implements ILogger

func AddSingletonILoggerByFunc

func AddSingletonILoggerByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddSingletonILoggerByFunc adds a type by a custom func

func AddSingletonILoggerByObj

func AddSingletonILoggerByObj(builder *di.Builder, obj interface{})

AddSingletonILoggerByObj adds a prebuilt obj

func AddTransientILogger

func AddTransientILogger(builder *di.Builder, implType reflect.Type)

AddTransientILogger adds a type that implements ILogger

func AddTransientILoggerByFunc

func AddTransientILoggerByFunc(builder *di.Builder, implType reflect.Type, build func(ctn di.Container) (interface{}, error))

AddTransientILoggerByFunc adds a type by a custom func

Types

type ILogger

type ILogger interface {
	Error() *zerolog.Event
	Debug() *zerolog.Event
	Fatal() *zerolog.Event
	Info() *zerolog.Event
	Warn() *zerolog.Event
	Trace() *zerolog.Event

	GetLogger() *zerolog.Logger

	ErrorL(logger *zerolog.Logger) *zerolog.Event
	DebugL(logger *zerolog.Logger) *zerolog.Event
	FatalL(logger *zerolog.Logger) *zerolog.Event
	InfoL(logger *zerolog.Logger) *zerolog.Event
	WarnL(logger *zerolog.Logger) *zerolog.Event
	TraceL(logger *zerolog.Logger) *zerolog.Event
}

ILogger interface

func GetILoggerFromContainer

func GetILoggerFromContainer(ctn di.Container) ILogger

GetILoggerFromContainer alternative to SafeGetILoggerFromContainer but panics of object is not present

func SafeGetILoggerFromContainer

func SafeGetILoggerFromContainer(ctn di.Container) (ILogger, error)

SafeGetILoggerFromContainer trys to get the object by type, will not panic, returns nil and error

Jump to

Keyboard shortcuts

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