Documentation ¶
Index ¶
Constants ¶
View Source
const ( LevelFieldName = "logger.level" LevelDefault = level.Error )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ configurator.Component, reConfiguration.Component, }, Constructor: app.Constructor(func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(Logger *ReConfiguration) *logrus.Logger { return Logger.Logger }, func(Logger *ReConfiguration) Logger { return Logger }, func(Logger *ReConfiguration) Debuger { return Logger }, func(Logger *ReConfiguration) Informer { return Logger }, func(Logger *ReConfiguration) Warner { return Logger }, func(Logger *ReConfiguration) Printer { return Logger }, ) }), BindFlags: app.BindFlags(func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar(&config.Level, LevelFieldName, LevelDefault, "setting log level") }) }), Run: app.Run(func(container container.Container) error { return container.Invoke(func( logger *ReConfiguration, reConfiguration reConfiguration.ReConfiguration, ) { reConfiguration.Registration(logger) logger.Info("logger: registration in the reConfigurator") }) }), ServeChan: app.ServeChan(func(container container.Container, isServeChan chan struct{}) error { return container.Invoke(func(logger *ReConfiguration, closer closer.Closer, appConfig *app.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.
type Logger ¶
type Logger interface { Debuger Informer Warner Printer Errorf(string, ...interface{}) Error(...interface{}) }
Logger : General logger interface for any implementation.
type ReConfiguration ¶
func NewReConfiguration ¶
func NewReConfiguration(config *Config) (*ReConfiguration, error)
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(config *Config, configurator configurator.Configurator) (*ReConfiguration, error)
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
Click to show internal directories.
Click to hide internal directories.