glog

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogSourceFromString = map[string]Source{
	"":                LogInvalid,
	"damage":          LogDamageEvent,
	"pre_damage_mods": LogPreDamageMod,
	"calc":            LogCalc,
	"element":         LogElementEvent,
	"snapshot":        LogSnapshotEvent,
	"status":          LogStatusEvent,
	"action":          LogActionEvent,
	"energy":          LogEnergyEvent,
	"character":       LogCharacterEvent,
	"enemy":           LogEnemyEvent,
	"sim":             LogSimEvent,
	"artifact":        LogArtifactEvent,
	"weapon":          LogWeaponEvent,
	"shield":          LogShieldEvent,
	"construct":       LogConstructEvent,
	"icd":             LogICDEvent,
	"debug":           LogDebugEvent,
	"warning":         LogWarnings,
	"player":          LogPlayerEvent,
	"heal":            LogHealEvent,
	"hurt":            LogHurtEvent,
	"cooldown":        LogCooldownEvent,
	"hitlag":          LogHitlagEvent,
	"user":            LogUserEvent,
}
View Source
var LogSourceString = [...]string{
	"",
	"damage",
	"pre_damage_mods",
	"calc",
	"element",
	"snapshot",
	"status",
	"action",
	"energy",
	"character",
	"enemy",
	"sim",
	"artifact",
	"weapon",
	"shield",
	"construct",
	"icd",
	"debug",
	"warning",
	"player",
	"heal",
	"hurt",
	"cooldown",
	"hitlag",
	"user",
}

Functions

This section is empty.

Types

type Ctrl

type Ctrl struct {
	// contains filtered or unexported fields
}

func (*Ctrl) Dump

func (c *Ctrl) Dump() ([]byte, error)

func (Ctrl) MarshalEasyJSON

func (v Ctrl) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Ctrl) MarshalJSON

func (v Ctrl) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Ctrl) NewEvent

func (c *Ctrl) NewEvent(msg string, typ Source, srcChar int) Event

func (*Ctrl) NewEventBuildMsg

func (c *Ctrl) NewEventBuildMsg(typ Source, srcChar int, msg ...string) Event

func (*Ctrl) UnmarshalEasyJSON

func (v *Ctrl) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Ctrl) UnmarshalJSON

func (v *Ctrl) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Event

type Event interface {
	LogSource() Source                            //returns the type of this log event i.e. character, sim, damage, etc...
	StartFrame() int                              //returns the frame on which this event was started
	Src() int                                     //returns the index of the character that triggered this event. -1 if it's not a character
	WriteBuildMsg(keyAndVal ...interface{}) Event //write additional keyAndVal pairs to the event
	Write(key string, val interface{}) Event      //write additional keyAndVal pairs to the event
	SetEnded(f int) Event
}

Event describes one event to be logged

type EventArr

type EventArr []*LogEvent

func (EventArr) MarshalEasyJSON

func (v EventArr) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (EventArr) MarshalJSON

func (v EventArr) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*EventArr) UnmarshalEasyJSON

func (v *EventArr) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*EventArr) UnmarshalJSON

func (v *EventArr) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LogEvent

type LogEvent struct {
	Typ      Source                 `json:"event"`
	F        int                    `json:"frame"`
	Ended    int                    `json:"ended"`
	SrcChar  int                    `json:"char_index"`
	Msg      string                 `json:"msg,nocopy"`
	Logs     map[string]interface{} `json:"logs"`
	Ordering map[string]int         `json:"ordering"`
	// contains filtered or unexported fields
}

func (*LogEvent) LogSource

func (e *LogEvent) LogSource() Source

func (LogEvent) MarshalEasyJSON

func (v LogEvent) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LogEvent) MarshalJSON

func (v LogEvent) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LogEvent) SetEnded

func (e *LogEvent) SetEnded(end int) Event

func (*LogEvent) Src

func (e *LogEvent) Src() int

func (*LogEvent) StartFrame

func (e *LogEvent) StartFrame() int

func (*LogEvent) UnmarshalEasyJSON

func (v *LogEvent) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LogEvent) UnmarshalJSON

func (v *LogEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*LogEvent) Write

func (e *LogEvent) Write(key string, value interface{}) Event

func (*LogEvent) WriteBuildMsg

func (e *LogEvent) WriteBuildMsg(keysAndValues ...interface{}) Event

type Logger

type Logger interface {
	// NewEvent(msg string, typ Source, srcChar int, keysAndValues ...interface{}) Event
	NewEvent(msg string, typ Source, srcChar int) Event
	NewEventBuildMsg(typ Source, srcChar int, msg ...string) Event
	Dump() ([]byte, error) //print out all the logged events in array of JSON strings in the ordered they were added
}

Logger records LogEvents

func New

func New(f *int, size int) Logger

type NilLogEvent

type NilLogEvent struct{}

NilLogEvent implements LogEvent and is used when no logger is needed

func (*NilLogEvent) LogSource

func (n *NilLogEvent) LogSource() Source

func (*NilLogEvent) SetEnded

func (n *NilLogEvent) SetEnded(f int) Event

func (*NilLogEvent) Src

func (n *NilLogEvent) Src() int

func (*NilLogEvent) StartFrame

func (n *NilLogEvent) StartFrame() int

func (*NilLogEvent) Write

func (n *NilLogEvent) Write(key string, val interface{}) Event

func (*NilLogEvent) WriteBuildMsg

func (n *NilLogEvent) WriteBuildMsg(keyAndVal ...interface{}) Event

type NilLogger

type NilLogger struct{}

NilLogger implements Logger and is used when no logger is needed

func (*NilLogger) Dump

func (n *NilLogger) Dump() ([]byte, error)

func (*NilLogger) NewEvent

func (n *NilLogger) NewEvent(msg string, typ Source, srcChar int) Event

func (*NilLogger) NewEventBuildMsg

func (n *NilLogger) NewEventBuildMsg(typ Source, srcChar int, msg ...string) Event

type Source

type Source int
const (
	LogInvalid     Source = iota
	LogDamageEvent        //tracks damages
	LogPreDamageMod
	LogCalc         //detailed calcs
	LogElementEvent //tracks elemental application
	LogSnapshotEvent
	LogStatusEvent
	LogActionEvent
	LogEnergyEvent
	LogCharacterEvent
	LogEnemyEvent
	LogSimEvent
	LogArtifactEvent
	LogWeaponEvent
	LogShieldEvent
	LogConstructEvent
	LogICDEvent
	LogDebugEvent    // for debug purposes
	LogWarnings      // for things that go wrong
	LogPlayerEvent   // for events related to player i.e. stamina, swap cd, healing, taking dmg etc..
	LogHealEvent     // healing events
	LogHurtEvent     // taking dmg event
	LogCooldownEvent // for tracking things going on and off cooldown
	LogHitlagEvent   // for debugging hitlag
	LogUserEvent     //user print event
)

func (Source) String

func (l Source) String() string

Jump to

Keyboard shortcuts

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