Documentation
¶
Index ¶
- type CachedLogFieldExtractor
- func (c *CachedLogFieldExtractor) DisplayID(l *LogEntity) string
- func (c *CachedLogFieldExtractor) ID(l *LogEntity) string
- func (c *CachedLogFieldExtractor) LogBody(l *LogEntity) string
- func (c *CachedLogFieldExtractor) MainMessage(l *LogEntity) (string, error)
- func (c *CachedLogFieldExtractor) SetLogBodyCacheDirect(logBody string)
- func (c *CachedLogFieldExtractor) Severity(l *LogEntity) (enum.Severity, error)
- func (c *CachedLogFieldExtractor) Timestamp(l *LogEntity) time.Time
- type CommonLogFieldExtractor
- type LogEntity
- func (l *LogEntity) DisplayId() string
- func (l *LogEntity) GetChildYamlOf(path string) (string, error)
- func (l *LogEntity) GetInt(path string) (int, error)
- func (l *LogEntity) GetIntOrDefault(path string, def int) int
- func (l *LogEntity) GetString(path string) (string, error)
- func (l *LogEntity) GetStringOrDefault(path string, def string) string
- func (l *LogEntity) Has(path string) bool
- func (l *LogEntity) HasKLogField(klogField string) bool
- func (l *LogEntity) ID() string
- func (l *LogEntity) KLogField(klogField string) (string, error)
- func (l *LogEntity) LogBody() string
- func (l *LogEntity) MainMessage() (string, error)
- func (l *LogEntity) Severity() (enum.Severity, error)
- func (l *LogEntity) Timestamp() time.Time
- type UnreachableCommonFieldExtractor
- func (UnreachableCommonFieldExtractor) DisplayID(l *LogEntity) string
- func (UnreachableCommonFieldExtractor) ID(l *LogEntity) string
- func (u *UnreachableCommonFieldExtractor) LogBody(l *LogEntity) string
- func (UnreachableCommonFieldExtractor) MainMessage(l *LogEntity) (string, error)
- func (UnreachableCommonFieldExtractor) Severity(l *LogEntity) (enum.Severity, error)
- func (UnreachableCommonFieldExtractor) Timestamp(l *LogEntity) time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedLogFieldExtractor ¶
type CachedLogFieldExtractor struct {
// contains filtered or unexported fields
}
CachedLogFieldExtractor implements CommonLogFieldExtractor and call the parent CommonLogFieldExtractor only when it was needed because accessing log fields from the Reader interface is a heavy operation.
func NewCachedLogFieldExtractor ¶
func NewCachedLogFieldExtractor(parent CommonLogFieldExtractor) *CachedLogFieldExtractor
func (*CachedLogFieldExtractor) DisplayID ¶
func (c *CachedLogFieldExtractor) DisplayID(l *LogEntity) string
DisplayID implements CommonLogFieldExtractor.
func (*CachedLogFieldExtractor) ID ¶
func (c *CachedLogFieldExtractor) ID(l *LogEntity) string
ID implements CommonLogFieldExtractor.
func (*CachedLogFieldExtractor) LogBody ¶
func (c *CachedLogFieldExtractor) LogBody(l *LogEntity) string
LogBody implements CommonLogFieldExtractor.
func (*CachedLogFieldExtractor) MainMessage ¶
func (c *CachedLogFieldExtractor) MainMessage(l *LogEntity) (string, error)
MainMessage implements CommonLogFieldExtractor.
func (*CachedLogFieldExtractor) SetLogBodyCacheDirect ¶
func (c *CachedLogFieldExtractor) SetLogBodyCacheDirect(logBody string)
SetLogBodyCacheDirect set the given logBody as the cache of LogBody.
type CommonLogFieldExtractor ¶
type CommonLogFieldExtractor interface { // Get unique ID from a log. Unique but shorter id is preferable. ID(l *LogEntity) string // Get the timestamp from a log. This is used for sorting. Timestamp(l *LogEntity) time.Time // Extract the main content of the structured logging. // textPayload or jsonPayload.MESSAGE in GCP MainMessage(l *LogEntity) (string, error) // Severity of this log. Severity(l *LogEntity) (enum.Severity, error) // ID visible to user. This value isn't necessary to be unique. DisplayID(l *LogEntity) string // Entire log body represented as a string. LogBody(l *LogEntity) string }
CommonLogFieldExtractor extracts information being available for all log entries(e.g timestamp)..etc These fields can be used outside of parsers specific to log types.
type LogEntity ¶
type LogEntity struct { LogType enum.LogType Fields structure.Reader // contains filtered or unexported fields }
LogEntity corresponds to a log record. Log itself is just a structured data and the main functionality is provided from structure.Reader. LogEntity adds few methods to get the common fields in logs like timestamp,id, severity ...etc.
func NewLogEntity ¶
func NewLogEntity(reader *structure.Reader, commonFieldExtractor CommonLogFieldExtractor) *LogEntity
func (*LogEntity) GetStringOrDefault ¶
func (*LogEntity) HasKLogField ¶
func (*LogEntity) MainMessage ¶
type UnreachableCommonFieldExtractor ¶
type UnreachableCommonFieldExtractor struct{}
Empty commmon log field extractor. Just for testing purpose.
func (UnreachableCommonFieldExtractor) DisplayID ¶
func (UnreachableCommonFieldExtractor) DisplayID(l *LogEntity) string
DisplayID implements CommonLogFieldExtractor.
func (UnreachableCommonFieldExtractor) ID ¶
func (UnreachableCommonFieldExtractor) ID(l *LogEntity) string
func (*UnreachableCommonFieldExtractor) LogBody ¶
func (u *UnreachableCommonFieldExtractor) LogBody(l *LogEntity) string
LogBody implements CommonLogFieldExtractor.
func (UnreachableCommonFieldExtractor) MainMessage ¶
func (UnreachableCommonFieldExtractor) MainMessage(l *LogEntity) (string, error)