log

package
v0.0.0-...-f9573de Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HumanReadable = func() bool {
	if len(os.Getenv("HUMAN_LOG")) > 0 {
		return true
	}
	return false
}()

HumanReadable, if true, outputs log events in a human readable format

View Source
var Namespace = "service-namespace"

Namespace is the service namespace used for logging

Functions

func Context

func Context(req *http.Request) string

Context returns a context ID from a request (using X-Request-Id)

func Debug

func Debug(message string, data Data)

Debug is a structured trace message

func DebugC

func DebugC(context string, message string, data Data)

DebugC is a structured debug message with context

func DebugR

func DebugR(req *http.Request, message string, data Data)

DebugR is a structured debug message for a request

func Error

func Error(err error, data Data)

Error is a structured error message

func ErrorC

func ErrorC(context string, err error, data Data)

ErrorC is a structured error message with context

func ErrorR

func ErrorR(req *http.Request, err error, data Data)

ErrorR is a structured error message for a request

func Event

func Event(name string, context string, data Data)

Event records an event

func Handler

func Handler(h http.Handler) http.Handler

Handler wraps a http.Handler and logs the status code and total response time

func Trace

func Trace(message string, data Data)

Trace is a structured trace message

func TraceC

func TraceC(context string, message string, data Data)

TraceC is a structured trace message with context

func TraceR

func TraceR(req *http.Request, message string, data Data)

TraceR is a structured trace message for a request

Types

type Data

type Data map[string]interface{}

Data contains structured log data

Jump to

Keyboard shortcuts

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