logger

package
v0.1.189 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 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

View Source
var ReflectTypeISingletonLogger = di.GetInterfaceReflectType((*ISingletonLogger)(nil))

ReflectTypeISingletonLogger used when your service claims to implement ISingletonLogger

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 AddScopedISingletonLogger added in v0.1.166

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

AddScopedISingletonLogger adds a type that implements ISingletonLogger

func AddScopedISingletonLoggerByFunc added in v0.1.166

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

AddScopedISingletonLoggerByFunc 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 AddSingletonISingletonLogger added in v0.1.166

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

AddSingletonISingletonLogger adds a type that implements ISingletonLogger

func AddSingletonISingletonLoggerByFunc added in v0.1.166

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

AddSingletonISingletonLoggerByFunc adds a type by a custom func

func AddSingletonISingletonLoggerByObj added in v0.1.166

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

AddSingletonISingletonLoggerByObj 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

func AddTransientISingletonLogger added in v0.1.166

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

AddTransientISingletonLogger adds a type that implements ISingletonLogger

func AddTransientISingletonLoggerByFunc added in v0.1.166

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

AddTransientISingletonLoggerByFunc adds a type by a custom func

func RemoveAllILogger added in v0.1.144

func RemoveAllILogger(builder *di.Builder)

RemoveAllILogger removes all ILogger from the DI

func RemoveAllISingletonLogger added in v0.1.166

func RemoveAllISingletonLogger(builder *di.Builder)

RemoveAllISingletonLogger removes all ISingletonLogger from the DI

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
}

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

type ISingletonLogger added in v0.1.166

type ISingletonLogger interface {
	ILogger
}

ISingletonLogger when you absolutely need a singleton logger

func GetISingletonLoggerFromContainer added in v0.1.166

func GetISingletonLoggerFromContainer(ctn di.Container) ISingletonLogger

GetISingletonLoggerFromContainer alternative to SafeGetISingletonLoggerFromContainer but panics of object is not present

func SafeGetISingletonLoggerFromContainer added in v0.1.166

func SafeGetISingletonLoggerFromContainer(ctn di.Container) (ISingletonLogger, error)

SafeGetISingletonLoggerFromContainer 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