Documentation ¶
Index ¶
- Variables
- func Bind(eventName string, inc int) event.Bindable
- func Inc(eventName string)
- func IsTimedStat(s string) bool
- func TimedBind(eventName string, on bool) event.Bindable
- func TimedOff(eventName string) event.Bindable
- func TimedOn(eventName string) event.Bindable
- func TrackStats(no int, data interface{}) int
- func TrackTimeStats(no int, data interface{}) int
- func Trigger(eventName string, inc int)
- func TriggerOff(eventName string)
- func TriggerOn(eventName string)
- func TriggerTimed(eventName string, on bool)
- type Event
- type History
- type Statistics
- func (st *Statistics) Inc(eventName string)
- func (st *Statistics) IsTimedStat(s string) bool
- func (st *Statistics) TrackStats(no int, data interface{}) int
- func (st *Statistics) TrackTimeStats(no int, data interface{}) int
- func (st *Statistics) Trigger(eventName string, inc int)
- func (st *Statistics) TriggerOff(eventName string)
- func (st *Statistics) TriggerOn(eventName string)
- func (st *Statistics) TriggerTimed(eventName string, on bool)
Constants ¶
This section is empty.
Variables ¶
var ( // DefStatistics is a base set of statistics used by package-level calls // When using multiple statistics, avoid using overlapping event names DefStatistics = NewStatistics() )
Functions ¶
func Inc ¶
func Inc(eventName string)
Inc triggers an event, incrementing the given statistic by one
func IsTimedStat ¶
IsTimedStat returns whether the given stat name is a part of this statistics' set of timed stats
func TrackStats ¶
TrackStats records a stat event to the Statistics map and creates the statistic if it does not already exist
func TrackTimeStats ¶
TrackTimeStats acts like TrackStats, but tracks durations of events. If the event has not started, it logs a start time, and then when the event ends it will log the delta since the start.
func TriggerOff ¶
func TriggerOff(eventName string)
TriggerOff triggers the given event, toggling it off
func TriggerOn ¶
func TriggerOn(eventName string)
TriggerOn triggers the given event, toggling it on
func TriggerTimed ¶
TriggerTimed triggers the given event, toggling it on or off
Types ¶
type History ¶
A History keeps track of any recorded occurrences of this statstic and their magnitude
func NewHistory ¶
NewHistory creates a stat
type Statistics ¶
type Statistics struct {
// contains filtered or unexported fields
}
Statistics stores the ongoing results of TrackStats and TrackTimeStats
func (*Statistics) Inc ¶
func (st *Statistics) Inc(eventName string)
Inc triggers an event, incrementing the given statistic by one
func (*Statistics) IsTimedStat ¶
func (st *Statistics) IsTimedStat(s string) bool
IsTimedStat returns whether the given stat name is a part of this statistics' set of timed stats
func (*Statistics) TrackStats ¶
func (st *Statistics) TrackStats(no int, data interface{}) int
TrackStats records a stat event to the Statistics map and creates the statistic if it does not already exist
func (*Statistics) TrackTimeStats ¶
func (st *Statistics) TrackTimeStats(no int, data interface{}) int
TrackTimeStats acts like TrackStats, but tracks durations of events. If the event has not started, it logs a start time, and then when the event ends it will log the delta since the start.
func (*Statistics) Trigger ¶
func (st *Statistics) Trigger(eventName string, inc int)
Trigger triggers the given event with a given increment to update a statistic
func (*Statistics) TriggerOff ¶
func (st *Statistics) TriggerOff(eventName string)
TriggerOff triggers the given event, toggling it off
func (*Statistics) TriggerOn ¶
func (st *Statistics) TriggerOn(eventName string)
TriggerOn triggers the given event, toggling it on
func (*Statistics) TriggerTimed ¶
func (st *Statistics) TriggerTimed(eventName string, on bool)
TriggerTimed triggers the given event, toggling it on or off