granitic: github.com/graniticio/granitic/facility/logger Index | Files

package logger

import "github.com/graniticio/granitic/facility/logger"

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 detailled in the logging package.

Index

Package Files

builder.go controlloglevel.go decorator.go globalloglevel.go null.go

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"
)

func AddRuntimeCommandsForFrameworkLogging Uses

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 Uses

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 Uses

func BuildFormatterFromConfig(ca *config.Accessor) (*logging.LogMessageFormatter, error)

BuildFormatterFromConfig uses configuration to determine the format for application logs

func BuildWritersFromConfig Uses

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

BuildWritersFromConfig uses configuration to determine the writers for logging

type FacilityBuilder Uses

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 Uses

func (alfb *FacilityBuilder) BuildAndRegister(lm *logging.ComponentLoggerManager, ca *config.Accessor, cn *ioc.ComponentContainer) error

BuildAndRegister implements FacilityBuilder.BuildAndRegister

func (*FacilityBuilder) DependsOnFacilities Uses

func (alfb *FacilityBuilder) DependsOnFacilities() []string

DependsOnFacilities implements FacilityBuilder.DependsOnFacilities

func (*FacilityBuilder) FacilityName Uses

func (alfb *FacilityBuilder) FacilityName() string

FacilityName implements FacilityBuilder.FacilityName

type FrameworkLogDecorator Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func (nlfb *NullLoggingFacilityBuilder) DependsOnFacilities() []string

DependsOnFacilities implements FacilityBuilder.DependsOnFacilities

func (*NullLoggingFacilityBuilder) FacilityName Uses

func (nlfb *NullLoggingFacilityBuilder) FacilityName() string

FacilityName implements FacilityBuilder.FacilityName

Package logger imports 12 packages (graph). Updated 2019-11-19. Refresh now. Tools for package owners.