report: github.com/robtuley/report Index | Files

package report

import "github.com/robtuley/report"

Index

Package Files

action.go batchpost.go channels.go file.go global.go info.go json.go runtime.go stdout.go timer.go

Constants

const MaxObserverConcurrency = 50

MaxObserverConcurrency specifies the maximum concurrent executing observer go-routines

func Action Uses

func Action(event string, payload Data)

Action logs events that need intervention or resolving.

report.Action("http.unavailable", report.Data{"path":req.URL.Path, "error":err.Error()})

func BatchPostToURL Uses

func BatchPostToURL(url string)

BatchPostToURL HTTP POSTs events in batches to a URL

func Drain Uses

func Drain()

Drain waits for events to drain down before exiting, usually called before exit on main func

func main {
	defer report.Drain()

	// ... snip ...
}

func File Uses

func File(filename string)

File write events to the specified log file

func Global Uses

func Global(payload Data)

Global adds a global data element to all logged events (e.g. if aggregating across services).

report.Global(report.Data{"service":"MyServiceName","version":"1.5.2"})

func Info Uses

func Info(event string, payload Data)

Info logs event that will provide context to any events requiring action.

report.Info("http.request", report.Data{"path":req.URL.Path, "ua":req.UserAgent()})

func Observe Uses

func Observe(o Observer)

Observe allows a custom callback into the log stream.

report.Observe(func (d report.Data){ log.Println(d) })

func RuntimeStatsEvery Uses

func RuntimeStatsEvery(every time.Duration)

RuntimeStatsEvery logs an event with golang runtime statistics at the specified time interval

func StdOut Uses

func StdOut()

StdOut write events to stdout

func Tick Uses

func Tick() time.Time

Tick starts a timer event with a value for the later call to Tock

func Tock Uses

func Tock(start time.Time, event string, payload Data)

Tock reports timer telemetry data recording the time since the Tick.

defer report.Tock(report.Tick(), "mongo.query", report.Data{"q":query})

type Data Uses

type Data map[string]interface{}

Data is a string-keyed map of unstructured data relevant to the event

type Observer Uses

type Observer func(Data)

Observer allows custom functional interception of the log stream

Package report imports 8 packages (graph) and is imported by 3 packages. Updated 2016-07-29. Refresh now. Tools for package owners.