# Packages
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
AllLevels is a convenience function returning all levels as a slice.
CtxWithEntry returns a context with Entry e as its value.
CtxWithLogger returns a context with Logger l as its value.
CustomOption takes the name of a method on the UnderlyingLogger of a Logger implementationas well as a value, and returns an Option.
DefaultConfig returns a Config instance with sane defaults.env is a callback for looking up EnvKeys, it is set to os.Getenv if nil.Fields and values returned by this function can be altered.
EntryFromCtx returns the Entry in ctx, or nil if none exists.
LevelFromString parses str and returns the closest level.If one isn't found the default level is returned.
LoggerFromCtx returns the Logger in ctx, or nil if none exists.
Noop returns an implementation of Logger that does nothing when its methods are called.This can also be retrieved using "noop" with "Open", though in that case any configuration is ignored.
Open returns a new instance of the selected Logger with config and options.
Register registers the provided NewLogger function under the given name for use with Open.Note, this method is not concurreny safe, nil NewLoggers or duplicate registrationwill cause a panic.
# Constants
CallerField is a key for Logger data.
DEBUG Level.
EntryKey is the key value to use with context.Context for Logger put and retrieval.
Environment is the EnvKey used for looking up the current deployment environment; Values commonly dev || prod.
ERROR Level.
ErrStack is the EnvKey used for looking up error/stack trace logging; Value should be true || True || TRUE.
FATAL Level; note, depending on usage this will cause the logger to force a program exit.
ImplementationDefaultFormat leaves the format up to the logger implementation default.
INFO Level; this is the default (zero value).
JSONFormat is the default (zero value) format for loggers registered with this package.
LoggerKey is the key value to use with context.Context for Logger put and retrieval.
LogLevel is the EnvKey used for looking up the log level.
PANIC Level; note, depending on usage this will cause the logger to panic.
PanicStack is a key for Logger data.
PanicValue is a key for Logger data.
ReqDuration is a key for Logger data.
SentryDSN is the EnvKey used for looking up the Sentry project DNS; Empty value disables Sentry.
SentryLevels is the EnvKey used for looking up which log levels will be sent to Sentry; Values should be comma separated.
StackField is a key for Logger data.
TRACE Level.
WARN Level.
XRequestID is a common field and header from API calls.
XSpanID is a common field and header from API calls.
XTraceID is a common field and header from API calls.
# Interfaces
Entry is the primary interface by which individual log entries are made.
Logger is the minimum interface loggers should implement when used with CTPx packages.
UnderlyingLogger is an escape hatch allowing Loggers registered with this packagethe option to return their underlying implementation, as well as reset it.Note this is currently required for CustomOption's to work.
# Type aliases
EnvKey is a publicly documented string type for environment lookups performed for DefaultConfig.It is otherwise unspecial.
Level is the base type for logging levels supported by this package.
LoggerFormat is the base type for logging formats supported by this package.
NewLogger is a function type for Logger implemenations to register themselves.
Option is a function type that accepts an interface value and returns an error.