logging

package
v4.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCaller = log.Caller(4)

DefaultCaller is an alternative to the go-kit object of the same name to account for wrapping

View Source
var DefaultTimestampUTC = log.DefaultTimestampUTC

DefaultTimestampUTC is a passthrough to the go-kit object of the same name

View Source
var NewFromKitLogger = NewFrom

NewFromKitLogger wraps a BaseLogger (e.g., go-kit) in our custom extension

Functions

This section is empty.

Types

type BaseLogger added in v4.6.0

type BaseLogger interface {
	Log(keyvals ...interface{}) error
}

func BaseFrom added in v4.6.0

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 added in v4.6.0

func NewFrom(l BaseLogger) Logger

NewFrom wraps a BaseLogger (e.g., go-kit) in our custom extension

func NewJSONLogger

func NewJSONLogger() Logger

NewJSONLogger creates a new logger that writes json to stdout

func NewLogfmtLogger

func NewLogfmtLogger() Logger

NewLogfmtLogger creates a new logger that writes logfmt to stdout

func With

func With(l Logger, keyvals ...interface{}) Logger

With wraps a logger so that every emitted line contains the provided key/val pairs

func WithContext

func WithContext(ctx context.Context, logger Logger, keyvals ...interface{}) Logger

WithContext wraps a logger to include the request_id from a context in log messages

func WithLevel

func WithLevel(l Logger, levelStr string) Logger

WithLevel wraps a logger to filter out logs lower than the designated level

func WithRequest

func WithRequest(req *http.Request, l Logger, keyvals ...interface{}) Logger

WithRequest wraps a logger with fields from a http.Request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL