logging

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ATTR_HOST      = "host"
	ATTR_USER      = "user"
	ATTR_PATH      = "path"
	ATTR_NAMESPACE = "namespace"
)

standard logging value attribute names used in this library.

Variables

View Source
var REALM = logging.DefineRealm("ocm", "general realm used for the ocm go library.")

REALM is used to tag all logging done by this library with the ocm tag. This is also used as message context to configure settings for all log output provided by this library.

Functions

func Configure

func Configure(config *logcfg.Config, extra ...string) error

Configure applies configuration for the default log context provided by this package.

func ConfigureGlobal

func ConfigureGlobal(config *logcfg.Config, extra ...string) error

ConfigureGlobal applies configuration for the default global log context provided by this package.

func ConfigureOCM

func ConfigureOCM(config *logcfg.Config, extra ...string) error

ConfigureOCM applies configuration for the default global ocm log context provided by this package.

func DefineSubRealm

func DefineSubRealm(desc string, names ...string) logging.Realm

func DynamicLogger

func DynamicLogger(messageContext ...logging.MessageContext) logging.UnboundLogger

DynamicLogger gets an unbound logger based on the default library logging context.

func ErrorMessage

func ErrorMessage(err error) *string

func LogContext

func LogContext(ctx logging.Context, provider ...logging.ContextProvider) logging.Context

func Logger

func Logger(messageContext ...logging.MessageContext) logging.Logger

Logger determines a default logger for this given message context based on the rule settings for this library.

func NewBufferedContext

func NewBufferedContext() (logging.Context, *bytes.Buffer)

func NewDefaultContext

func NewDefaultContext() logging.Context

func PopContext

func PopContext()

func PushContext

func PushContext(ctx logging.Context)

func SetContext

func SetContext(ctx logging.Context)

SetContext sets a new preconfigured context. This function should be called prior to any configuration to avoid loosing them.

func SubRealm

func SubRealm(names ...string) logging.Realm

Types

type LogProvider

type LogProvider interface {
	logging.ContextProvider
	logging.AttributionContextProvider
	Logger(messageContext ...logging.MessageContext) logging.Logger
}

type StaticContext

type StaticContext struct {
	logging.Context
	// contains filtered or unexported fields
}

func Context

func Context() *StaticContext

Context returns the default logging configuration used for this library.

func NewContext

func NewContext(ctx logging.Context, global ...bool) *StaticContext

func (*StaticContext) Configure

func (s *StaticContext) Configure(config *logcfg.Config, extra ...string) error

Configure applies a configuration once. Every config identified by its hash is applied only once.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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