log

package
v0.0.0-...-f2e39e4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(err error, tags map[string]string)

Error logs an error and optional metadata to console and to any registered ErrorTracker

func Fatal

func Fatal(err error, tags map[string]string)

Fatal logs an error and optional metadata to console and to any registered ErrorTracker It will then panic.

func Handler

func Handler(h http.Handler) http.Handler

Handler returns a http.Handler that wraps h and prints request details to writer

func Info

func Info(message string, tags map[string]string)

Info logs messages and optional metdata to the console

func RegisterErrorTracker

func RegisterErrorTracker(errTracker ErrorTracker)

RegisterErrorTracker registers an error tracker which is called when errors are raised

func Timing

func Timing(name string, timing time.Duration, tags map[string]string)

Types

type ErrorTracker

type ErrorTracker interface {
	Name() string
	TrackError(err error, tags map[string]string)
	TrackFatal(err error, tags map[string]string)
}

ErrorTracker logs errors to an external service

func NewSentryErrorTracker

func NewSentryErrorTracker(dsn string) (ErrorTracker, error)

NewSentryErrorTracker returns an ErrorTracker backed by Sentry

Jump to

Keyboard shortcuts

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