logging

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: MIT Imports: 12 Imported by: 37

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogCTXKey logctxKeyT = "loggingContextKey"

LogCTXKey is the typed context key

Functions

func CheckFatal

func CheckFatal(err error)

CheckFatal exits the process if err != nil

func InjectHandler

func InjectHandler(mainLog Interface) func(http.Handler) http.Handler

InjectHandler injects a log instance to http.Request' context

func LogPanicWithStack added in v1.6.0

func LogPanicWithStack(log Interface, location string, r interface{}, vals ...interface{}) error

LogPanicWithStack writes the passed value r, together with a debug.Stack to a tmpfile and logs its location

func Logger

func Logger(name string) kitlog.Logger

Logger returns an Entry where the module field is set to name

func NewContext

func NewContext(ctx context.Context, log Interface) context.Context

NewContext helps constructing and wrapping a logger into a context

func RecoveryHandler

func RecoveryHandler() func(http.Handler) http.Handler

RecoveryHandler recovers handler panics and logs them using LogPanicWithStack

func SetCloseChan

func SetCloseChan(c chan<- os.Signal)

SetCloseChan sets a signal channel that is sent to when CheckFatal is used

func SetupLogging

func SetupLogging(w io.Writer)

SetupLogging will initialize the logger backend and set the flags.

func Writer

func Writer(unit string, l kitlog.Logger) io.WriteCloser

Writer returns a writer which logs each line that is written to it using a bufio.Scanner

Types

type Interface

type Interface kitlog.Logger

Interface renames the (go-kit/log).Logger interface for conveninence

func FromContext

func FromContext(ctx context.Context) Interface

FromContext extracts a logger from a context and casts to the log Interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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