event

package
v0.0.0-...-e2451da Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2015 License: MIT Imports: 9 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FilePath string // used for testing

FilePath is the full path to this source file.

This is meant to be used for internal sawmill testing only.

View Source
var RepoPath string

RepoPath is the path to the top of the sawmill repo.

This is meant to be used for internal sawmill testing only.

The value is used when obtaining a stack trace to determine where the trace should start. The first frame not in RepoPath is considered to be the top.

Functions

This section is empty.

Types

type Event

type Event struct {
	Id         uint64
	Level      Level
	Time       time.Time
	Message    string
	Fields     interface{}
	FlatFields map[string]interface{}
	Stack      []*StackFrame
}

func New

func New(id uint64, level Level, message string, fields interface{}, getStack bool) *Event

New creates a new Event object. The time is set to current time, and the fields are deep-copied.

type Level

type Level int
const (
	Debug, Dbg Level = iota, iota
	Info, _
	Notice, _
	Warning, Warn
	Error, Err
	Critical, Crit
	Alert, Alrt
	Emergency, Emerg
)

func (Level) Int

func (l Level) Int() int

func (Level) String

func (l Level) String() string

type StackFrame

type StackFrame struct {
	PC       uintptr
	File     string
	Line     int
	Function string
	Func     string
	Package  string
}

StackFrame describes an entry in a call stack.

func (*StackFrame) Source

func (sf *StackFrame) Source() []byte

Source returns the source code line of the stack frame. If the source cannot be read for any reason, nil is returned.

func (*StackFrame) SourceContext

func (sf *StackFrame) SourceContext(beforeCount int, afterCount int) (linesBefore [][]byte, line []byte, linesAfter [][]byte)

SourceContext retuns the source code lines surrounding the stack frame.

Directories

Path Synopsis
The formatter package is used to wrap an event with helper functions so it can be easily used in text templates.
The formatter package is used to wrap an event with helper functions so it can be easily used in text templates.

Jump to

Keyboard shortcuts

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