logging

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 9 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 added in v0.3.0

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

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

func DefineSubRealm added in v0.3.0

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

func DynamicLogger added in v0.3.0

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 added in v0.8.0

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 added in v0.9.0

func PopContext()

func PushContext added in v0.9.0

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 added in v0.3.0

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