Documentation ¶
Overview ¶
Package event provides a generalized construct for representing input from a source.Source.
Index ¶
- Constants
- type Action
- type Application
- type Bucket
- type CodeLocation
- type Context
- type Entity
- type Error
- type Event
- type Line
- type Message
- type SinkEvent
- type SourceURL
- func (u *SourceURL) HashInt() int
- func (u *SourceURL) HashString() string
- func (u *SourceURL) Normalize()
- func (u *SourceURL) QueryFlag(key string) bool
- func (u *SourceURL) QueryInt64(key string) (*int64, error)
- func (u *SourceURL) QueryKey(key string) (string, bool)
- func (u *SourceURL) ShortForm() string
- func (u *SourceURL) String() string
- type Timestamp
Constants ¶
const ( // Bucket1 is histogram Bucket 1. Bucket1 = iota // Bucket2 is histogram Bucket 2. Bucket2 // Bucket3 is histogram Bucket 3. Bucket3 // Bucket4 is histogram Bucket 4. Bucket4 // Bucket5 is histogram Bucket 5. Bucket5 // Bucket6 is histogram Bucket 6. Bucket6 // Bucket7 is histogram Bucket 7. Bucket7 // Bucket8 is histogram Bucket 8. Bucket8 // BucketUpperBound the highest Bucket. BucketUpperBound = iota - 1 )
const HumanTimeFormat = "human"
HumanTimeFormat procides human-friendly times via humanize.Time.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeLocation ¶
type CodeLocation string
CodeLocation is where the log event happened.
func (CodeLocation) Mark ¶
func (cl CodeLocation) Mark(category string)
Mark manages a per-code-location meter. These meters can be used to generate metrics, as well as rate limit specific locations.
type Entity ¶
type Entity string
Entity an entity name.
func (Entity) Abbreviate ¶
Abbreviate shortens the name of an entity by trimming characters from the least-significant parts of the caller forward. A string is shortened until it meets the maxWidth, or no further abbreviation can be made. Example: 'com.example.of.couture.SomeClass' would be 'c.e.o.couture.SomeClass' with a value of 23. Any value between 0 and 18 would generate: 'c.e.o.c.SomeClass'.
type Event ¶
type Event struct { // Timestamp the timestamp. This field is required, and should default to time.Now() if not present. Timestamp Timestamp `json:"timestamp" regroup:"timestamp"` // Level the level. This field is required, and should default to Info if not present. Level level.Level `json:"level" regroup:"level"` // Message the message. This field is required. Message Message `json:"message" regroup:"message"` // Application is the name of the application that generated this event. This field is optional. Application Application `json:"application" regroup:"application"` // Action the action name. This field is optional. Action Action `json:"action" regroup:"action"` // Line the line number. This field is optional. Line Line `json:"line" regroup:"line"` // Context the context name. This field is optional. Context Context `json:"context" regroup:"context"` // Entity the entity name. This field is optional. Entity Entity `json:"entity" regroup:"entity"` // Error the error. This field is optional. Error Error `json:"error" regroup:"error"` }
Event is a generalized log event.
func (Event) CodeLocation ¶
func (event Event) CodeLocation() CodeLocation
CodeLocation returns the location where the event happened.
type Line ¶
type Line uint64
Line a line number.
const ( // NoLineNumber indicates no line number is present. NoLineNumber Line = 0 )
type Message ¶
type Message string
Message a message.
type SinkEvent ¶
SinkEvent wraps an Event with additional application metadata.
func (SinkEvent) LevelMeterBucket ¶
LevelMeterBucket returns the
type SourceURL ¶
SourceURL represents a source-spcific URL to events.
func (*SourceURL) HashInt ¶
HashInt of the string version of this URL. The hash is used to provide consistent behavior for a URL across invocations (e.g., the color of the messages).
func (*SourceURL) HashString ¶
HashString is a hex version of the HashInt.
func (*SourceURL) Normalize ¶
func (u *SourceURL) Normalize()
Normalize fixes situations where scheme://some/path/list is given rather than scheme:///some/path/list. In the first case this results in a hostname of some and a path of /path/list. This action rewrites it into the proper second form.
func (*SourceURL) QueryFlag ¶
QueryFlag looks up a QueryKey parameter value. If the key exists with an empty value, it is the equivalent of having set the value to true.
func (*SourceURL) QueryInt64 ¶
QueryInt64 returns the value of the QueryKey parameter a pointer to an int64. If the parameter is not set, or is set to empty, a nil pointer with no error is returned.