Documentation
¶
Index ¶
Constants ¶
View Source
const LoggerKey loggerKey = "logger"
LoggerKey is the key to access the logger in context
Variables ¶
View Source
var ErrLoggerNotFoundInContext = errors.New("Logger not found in context")
ErrLoggerNotFoundInContext is the error when calling MustFromContext and the logger is not found
Functions ¶
Types ¶
type Logger ¶
Logger is a generic Logger interface
func FromContext ¶
FromContext gets the logger from context. If context does not exist, it returns nil.
func MustFromContext ¶
MustFromContext gets the logger from context. If context does not exist, it panics with a ErrLoggerNotFoundInContext.
type Provider ¶ added in v0.0.4
type Provider interface { // Get returns the Provider's attached logger in a thread safe manner Get() Logger // Replace replaces the provider's internal logger in a thread safe manner Replace(Logger) }
Provider is an interface to get a thread safe logger provider with the ability to replace the internal logger provided
func NewProvider ¶ added in v0.0.4
NewProvider returns a new Logger Provider from the given Logger l
Click to show internal directories.
Click to hide internal directories.