stats

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HTTPStart  = newEvent(httpStart, LevelBase)
	HTTPFinish = newEvent(httpFinish, LevelBase)

	ServerHandleStart  = newEvent(serverHandleStart, LevelDetailed)
	ServerHandleFinish = newEvent(serverHandleFinish, LevelDetailed)
	ReadHeaderStart    = newEvent(readHeaderStart, LevelDetailed)
	ReadHeaderFinish   = newEvent(readHeaderFinish, LevelDetailed)
	ReadBodyStart      = newEvent(readBodyStart, LevelDetailed)
	ReadBodyFinish     = newEvent(readBodyFinish, LevelDetailed)
	WriteStart         = newEvent(writeStart, LevelDetailed)
	WriteFinish        = newEvent(writeFinish, LevelDetailed)
)

Predefined events.

View Source
var (
	ErrNotAllowed = errors.NewPublic("event definition is not allowed after initialization")
	ErrDuplicated = errors.NewPublic("event name is already defined")
)

errors

Functions

func FinishInitialization

func FinishInitialization()

FinishInitialization freezes all events defined and prevents further definitions to be added.

func MaxEventNum

func MaxEventNum() int

MaxEventNum returns the number of event defined.

Types

type Event

type Event interface {
	Index() EventIndex
	Level() Level
}

Event is used to indicate a specific event.

func DefineNewEvent

func DefineNewEvent(name string, level Level) (Event, error)

DefineNewEvent allows user to add event definitions during program initialization.

type EventIndex

type EventIndex int

EventIndex indicates a unique event.

type Level

type Level int

Level sets the record level.

const (
	LevelDisabled Level = iota
	LevelBase
	LevelDetailed
)

Event levels.

type Status

type Status int8

Status is used to indicate the status of an event.

const (
	StatusInfo  Status = 1
	StatusWarn  Status = 2
	StatusError Status = 3
)

Predefined status.

Jump to

Keyboard shortcuts

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