xlog

package
v0.0.0-...-73d6a9a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProvided

func IsProvided(l OptionalLogger) bool

IsProvided returns true if l.OptionalLogger is not nil

func Module

func Module() fx.Option

Types

type Config

type Config struct {
	Prefix string `yaml:"prefix"`
}

Config holds log configuration

func LoadConfig

func LoadConfig(params LoadConfigParams) (Config, error)

LoadConfig create a new *Config and populate it with values from environment.

type LoadConfigParams

type LoadConfigParams struct {
	fx.In

	Provider config.Provider `optional:"true"`
}

type LoggerMapping

type LoggerMapping struct {
	fx.Out

	Logger *log.Logger `name:"x_logger"`
}

func NewLogger

func NewLogger(config Config) LoggerMapping

NewLogger returns a new logger configured with values from *Config.

type OptionalLogger

type OptionalLogger struct {
	fx.In

	Logger *log.Logger `name:"x_logger" optional:"true"`
}

OptionalLogger holds the injected and named 'x_logger' *log.Logger. Keep in mind that as it is a optional dependency, it can be nil. There is a helper method IsProvided in this same package that you can check if the value was provided or not.

Jump to

Keyboard shortcuts

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