Documentation ¶
Index ¶
Constants ¶
View Source
const (
// ContextKey is the string key used to store a logger in a Context
ContextKey = "grm-generate.logger"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger interface { // IsDebugEnabled returns true when the underlying logger is configured to // write debug messages, false otherwise. IsDebugEnabled() bool // WithValues adapts the internal logger with a set of additional key/value // data WithValues(...interface{}) // Debug writes a supplied log message about a resource that includes a set // of standard log values for the resource's kind, namespace, name, etc Debug(msg string, additionalValues ...interface{}) // Info writes a supplied log message about a resource that includes a set // of standard log values for the resource's kind, namespace, name, etc Info(msg string, additionalValues ...interface{}) // Enter logs an entry to a function or code block Enter(name string, additionalValues ...interface{}) // Exit logs an exit from a function or code block Exit(name string, err error, additionalValues ...interface{}) // Trace logs an entry to a function or code block and returns a functor // that can be called to log the exit of the function or code block Trace(name string, additionalValues ...interface{}) TraceExiter }
Logger is responsible for writing log messages
var ( // NoopLogger is useful for testing/mocking NoopLogger Logger = &voidLogger{} )
func FromContext ¶
FromContext returns a `Logger` from a saved key in the request context
type TraceExiter ¶
type TraceExiter func(err error, additionalValues ...interface{})
TraceExiter demarcates the end of a traced code block or function
Click to show internal directories.
Click to hide internal directories.