eventlog

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package eventlog provides logging of semi-structured events, particularly in service of downstream analysis, e.g. when machines are started, when a user issues a command, when failures happen.

For example, you can log events to CloudWatch Logs:

sess := session.NewSession()
cw := cloudwatchlogs.New(sess)
e := cloudwatch.NewEventer(cw, "myLogGroup", "myLogStream")
e.Event("rpcRetry", "org", "GRAIL", "retry", 0, "maxRetry", 10)
e.Event("machineStopped", "addr", "192.168.1.1", "duration", 3600.0, "startTime": 1584140534)

These events can now be analyzed and monitored using CloudWatch Logs tooling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Eventer

type Eventer interface {
	// Event logs an event of typ with (key string, value interface{}) fields given in fieldPairs
	// as k0, v0, k1, v1, ...kn, vn. For example:
	//
	//  s.Event("machineStart", "addr", "192.168.1.2", "time", time.Now().Unix())
	//
	// The value will be serialized as JSON.
	//
	// The key "eventType" is reserved. Field keys must be unique. Any violation will result
	// in the event being dropped and logged.
	//
	// Implementations must be safe for concurrent use.
	Event(typ string, fieldPairs ...interface{})
}

Eventer is called to log events.

type Log added in v0.0.11

type Log log.Level

Log is an Eventer that writes events to the logger. It's intended for debugging/development.

func (Log) Event added in v0.0.11

func (l Log) Event(typ string, fieldPairs ...interface{})

Event implements Eventer.

type Nop

type Nop struct{}

Nop is a no-op Eventer.

func (Nop) Event

func (Nop) Event(_ string, _ ...interface{})

Event implements Eventer.

func (Nop) String added in v0.0.11

func (Nop) String() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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