Documentation
¶
Overview ¶
Package logger provides the FrameworkLogging and ApplicationLogging facilities which control logging from framework and application components.
Full documentation for this facility can be found at https://granitic.io/ref/logging and GoDoc for the logging types that your application will interact with are detailed in the logging package.
Index ¶
- Constants
- func AddRuntimeCommandsForFrameworkLogging(ca *config.Accessor, flm *logging.ComponentLoggerManager, ...)
- func AddRuntimeCommandsForLogging(ca *config.Accessor, alm *logging.ComponentLoggerManager, ...)
- func BuildFormatterFromConfig(ca *config.Accessor) (logging.StringFormatter, error)
- func BuildWritersFromConfig(ca *config.Accessor) ([]logging.LogWriter, error)
- type FacilityBuilder
- type FrameworkLogDecorator
- type NullLoggingFacilityBuilder
Constants ¶
const ( // GlobalLogCommand is the name of the component able to alter log levels at runtime GlobalLogCommand = instance.FrameworkPrefix + "CommandGlobalLevel" )
const ( // LogLevelComponentName is the name of the component able to alter log levels at runtime LogLevelComponentName = instance.FrameworkPrefix + "CommandLogLevel" )
Variables ¶
This section is empty.
Functions ¶
func AddRuntimeCommandsForFrameworkLogging ¶ added in v2.1.0
func AddRuntimeCommandsForFrameworkLogging(ca *config.Accessor, flm *logging.ComponentLoggerManager, cn *ioc.ComponentContainer)
AddRuntimeCommandsForFrameworkLogging registers the runtime control commands related to logging with stubbed out application logging
func AddRuntimeCommandsForLogging ¶ added in v2.1.0
func AddRuntimeCommandsForLogging(ca *config.Accessor, alm *logging.ComponentLoggerManager, flm *logging.ComponentLoggerManager, cn *ioc.ComponentContainer)
AddRuntimeCommandsForLogging registers the runtime control commands related to logging
func BuildFormatterFromConfig ¶ added in v2.1.0
func BuildFormatterFromConfig(ca *config.Accessor) (logging.StringFormatter, error)
BuildFormatterFromConfig uses configuration to determine the format for application logs
Types ¶
type FacilityBuilder ¶
type FacilityBuilder struct { }
FacilityBuilder creates a new logging.ComponentLoggerManager for application components and updates the framework's ComponentLoggerManager (which was bootstraped with a command-line supplied global log level) with the application's logging configuration.
func (*FacilityBuilder) BuildAndRegister ¶
func (alfb *FacilityBuilder) BuildAndRegister(lm *logging.ComponentLoggerManager, ca *config.Accessor, cn *ioc.ComponentContainer) error
BuildAndRegister implements FacilityBuilder.BuildAndRegister
func (*FacilityBuilder) DependsOnFacilities ¶
func (alfb *FacilityBuilder) DependsOnFacilities() []string
DependsOnFacilities implements FacilityBuilder.DependsOnFacilities
func (*FacilityBuilder) FacilityName ¶
func (alfb *FacilityBuilder) FacilityName() string
FacilityName implements FacilityBuilder.FacilityName
type FrameworkLogDecorator ¶
type FrameworkLogDecorator struct { // The framework ComponentLoggerManager (as opposed to the application ComponentLoggerManager) LoggerManager *logging.ComponentLoggerManager // Logger to allow this decorator to log messages. FrameworkLogger logging.Logger }
FrameworkLogDecorator injects a framework logger into Granitic framework components.
func (*FrameworkLogDecorator) DecorateComponent ¶
func (fld *FrameworkLogDecorator) DecorateComponent(component *ioc.Component, container *ioc.ComponentContainer)
DecorateComponent injects a newly created Logger into the FrameworkLogger field of the subject component.
func (*FrameworkLogDecorator) OfInterest ¶
func (fld *FrameworkLogDecorator) OfInterest(component *ioc.Component) bool
OfInterest returns true if the subject component has a field of type logging.Logger and the name FrameworkLogger.
type NullLoggingFacilityBuilder ¶ added in v2.1.0
type NullLoggingFacilityBuilder struct { }
NullLoggingFacilityBuilder creates a minimal set of components to allow applications to run even if the application logging facility has been disabled
func (*NullLoggingFacilityBuilder) BuildAndRegister ¶ added in v2.1.0
func (nlfb *NullLoggingFacilityBuilder) BuildAndRegister(lm *logging.ComponentLoggerManager, ca *config.Accessor, cn *ioc.ComponentContainer) error
BuildAndRegister creates a decorator that will inject a 'null' logger into any component that asks for a an application logger
func (*NullLoggingFacilityBuilder) DependsOnFacilities ¶ added in v2.1.0
func (nlfb *NullLoggingFacilityBuilder) DependsOnFacilities() []string
DependsOnFacilities implements FacilityBuilder.DependsOnFacilities
func (*NullLoggingFacilityBuilder) FacilityName ¶ added in v2.1.0
func (nlfb *NullLoggingFacilityBuilder) FacilityName() string
FacilityName implements FacilityBuilder.FacilityName