Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelFieldName = "logger.level" LevelDefault = level.Error )
Variables ¶
View Source
var Component = &app2.Component{ Dependencies: app2.Components{ configurator.Component, }, Constructor: app2.Constructor(func(container container.Container) error { return container.Provides( NewConfig, NewWithConfigurator, func(Logger *logrus.Logger) Logger { return Logger }, func(Logger *logrus.Logger) Debuger { return Logger }, func(Logger *logrus.Logger) Informer { return Logger }, func(Logger *logrus.Logger) Warner { return Logger }, func(Logger *logrus.Logger) Printer { return Logger }, ) }), BindFlags: app2.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Level, LevelFieldName, LevelDefault, "setting log level") }) }), Serve: app2.ServeChan(func(container container.Container, isServeChan chan struct{}) error { return container.Invoke(func(logger Logger, closer closer.Closer, appConfig *app2.Config) { logger.Infof("app: '%s', pid '%d' - started", appConfig.Name, appConfig.PID) ctx, cancelFunc := context.WithCancel(closer.GetContext()) defer cancelFunc() isServeChan <- struct{}{} <-ctx.Done() logger.Infof("app: '%s', pid '%d' - shutdown", appConfig.Name, appConfig.PID) }) }), }
Functions ¶
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator) (*logrus.Logger, error)
Types ¶
type Config ¶
type Config struct {
Level string
}
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type Debuger ¶
type Debuger interface { Debugf(string, ...interface{}) Debug(...interface{}) }
Debuger : "debug" level recorder interface.
type Informer ¶
type Informer interface { Infof(string, ...interface{}) Info(...interface{}) }
Informer : "info" level recorder interface.
Click to show internal directories.
Click to hide internal directories.