Documentation
¶
Index ¶
Constants ¶
View Source
const (
// LoggerNameKey is a key we can use to denote zerologLogger names across implementations.
LoggerNameKey = "_name_"
)
View Source
const (
// ProviderZerolog indicates you'd like to use the zerolog Logger.
ProviderZerolog = "zerolog"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Name string `json:"name" mapstructure:"name" toml:"name"` Level Level `json:"level" mapstructure:"level" toml:"level"` Provider string `json:"provider" mapstructure:"provider" toml:"provider"` // contains filtered or unexported fields }
Config configures a zerologLogger.
type Logger ¶
type Logger interface { Info(string) Debug(string) Error(err error, whatWasHappeningWhenErrorOccurred string) Fatal(error) Printf(string, ...interface{}) SetLevel(Level) SetRequestIDFunc(RequestIDFunc) Clone() Logger WithName(string) Logger WithValues(map[string]interface{}) Logger WithValue(string, interface{}) Logger WithRequest(*http.Request) Logger WithResponse(response *http.Response) Logger WithError(error) Logger }
Logger represents a simple logging interface we can build wrappers around. Note that someone, naive and green, may be enticed to add a method to this interface akin to: WithQueryFilter(*types.QueryFilter) Logger This is a fool's errand, which would introduce a disallowed import cycle.
func EnsureLogger ¶
EnsureLogger guarantees that a zerologLogger is available.
func NewNoopLogger ¶
func NewNoopLogger() Logger
NewNoopLogger provides our noop zerologLogger to dependency managers.
func ProvideLogger ¶
ProvideLogger builds a Logger according to the provided config.
type RequestIDFunc ¶
RequestIDFunc fetches a string ID from a request.
Click to show internal directories.
Click to hide internal directories.