logger

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

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

View Source
const (
	// GlobalLogCommand is the name of the component able to alter log levels at runtime
	GlobalLogCommand = instance.FrameworkPrefix + "CommandGlobalLevel"
)
View Source
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

func BuildWritersFromConfig added in v2.1.0

func BuildWritersFromConfig(ca *config.Accessor) ([]logging.LogWriter, error)

BuildWritersFromConfig uses configuration to determine the writers for logging

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

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

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

Jump to

Keyboard shortcuts

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