event

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VerbNone     Level = 0
	VerbCritical Level = 1 << iota
	VerbError
	VerbWarning
	VerbNotice
	VerbInfo
	VerbDebug

	TxtDebug    = "DBUG"
	TxtInfo     = "INFO"
	TxtNotice   = "NOTE"
	TxtWarning  = "WARN"
	TxtError    = "ERR "
	TxtCritical = "CRIT"
	TxtContinue = "...."
)

Event message levels

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Level   Level    `json:"level"`
	Meta    MetaInfo `json:"meta"`
	Message string   `json:"msg"`
	Tags    tag.Tags `json:"tags"`
}

Event is a log unit

type Level

type Level int

Level defines the level of event

func (Level) MarshalJSON

func (e Level) MarshalJSON() ([]byte, error)

MarshalJSON values for Event Level

func (Level) String

func (e Level) String() string

String returns a text value for event level

type Logger

type Logger interface {
	WriteEvent(*Event)
	SetVerbose(Level)
	GetVerbose() Level
}

Logger outputs events

type MetaInfo

type MetaInfo struct {
	Host string    `json:"host"`
	PID  int       `json:"pid"`
	Time time.Time `json:"time"`
	File string    `json:"file"`
	Line int       `json:"line"`
	Func string    `json:"func"`
}

MetaInfo is source information about an event

func NewMetaInfo

func NewMetaInfo(calldepth int) (m MetaInfo)

NewMetaInfo generate a set of tags about the runtime.

Jump to

Keyboard shortcuts

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