Documentation ¶
Index ¶
- Variables
- func PatchStdLib(l Logger)
- type BaseLogger
- type Logger
- func NewFrom(l BaseLogger) Logger
- func NewJSONFileLogger(w io.Writer) Logger
- func NewJSONLogger() Logger
- func NewLogfmtFileLogger(w io.Writer) Logger
- func NewLogfmtLogger() Logger
- func With(l Logger, keyvals ...interface{}) Logger
- func WithAttributes(logger Logger, attrs ...telemetry.KeyValue) Logger
- func WithClientRequest(l Logger, req *http.Request) Logger
- func WithContext(ctx context.Context, logger Logger, keyvals ...interface{}) Logger
- func WithLevel(l Logger, levelStr string) Logger
- func WithRequest(req *http.Request, l Logger, keyvals ...interface{}) Logger
- func WithServerRequest(l Logger, req *http.Request, serverName, routeName string) Logger
Constants ¶
This section is empty.
Variables ¶
var DefaultCaller = log.Caller(4)
DefaultCaller is an alternative to the go-kit object of the same name to account for wrapping
var DefaultTimestampUTC = log.DefaultTimestampUTC
DefaultTimestampUTC is a passthrough to the go-kit object of the same name
var NewFromKitLogger = NewFrom
NewFromKitLogger wraps a BaseLogger (e.g., go-kit) in our custom extension
Functions ¶
func PatchStdLib ¶
func PatchStdLib(l Logger)
PatchStdLib sets up the stdlib global logger to run through the provided one instead
Types ¶
type BaseLogger ¶
type BaseLogger interface {
Log(keyvals ...interface{}) error
}
func BaseFrom ¶
func BaseFrom(l Logger) BaseLogger
type Logger ¶
type Logger interface { Log(keyvals ...interface{}) error Message(string, ...interface{}) Err(string, error, ...interface{}) Printf(string, ...interface{}) }
Logger is the extended logging interface for the corvee applications
func NewFrom ¶
func NewFrom(l BaseLogger) Logger
NewFrom wraps a BaseLogger (e.g., go-kit) in our custom extension
func NewJSONFileLogger ¶ added in v12.1.0
func NewJSONLogger ¶
func NewJSONLogger() Logger
NewJSONLogger creates a new logger that writes json to stdout
func NewLogfmtFileLogger ¶ added in v12.1.0
func NewLogfmtLogger ¶
func NewLogfmtLogger() Logger
NewLogfmtLogger creates a new logger that writes logfmt to stdout
func WithContext ¶
WithContext wraps a logger to include the request_id from a context in log messages
func WithRequest ¶
WithRequest wraps a logger with fields from a http.Request