Documentation ¶
Index ¶
- Constants
- func FormatWithCurrentTime(text string) (result string)
- func FormatWithEnv(text string) (result string)
- func FormatWithEventTime(text string, evevtTime time.Time) (result string)
- func SetConfig(c *Config)
- type Config
- type LogEvent
- func (t *LogEvent) AddTag(tags ...string)
- func (t LogEvent) Format(format string) (out string)
- func (t LogEvent) Get(field string) (v any)
- func (t LogEvent) GetString(field string) string
- func (t LogEvent) GetValue(field string) (any, bool)
- func (t LogEvent) MarshalIndent() (data []byte, err error)
- func (t LogEvent) MarshalJSON() (data []byte, err error)
- func (t *LogEvent) ParseTags(tags any) bool
- func (t *LogEvent) Remove(field string) bool
- func (t *LogEvent) RemoveTag(tags ...string)
- func (t *LogEvent) SetValue(field string, v any) bool
Constants ¶
View Source
const MessageField = "message"
View Source
const TagsField = "tags"
View Source
const TimestampField = "@timestamp"
TagsField is the event tags field name
Variables ¶
This section is empty.
Functions ¶
func FormatWithCurrentTime ¶
FormatWithCurrentTime format string with current time, ex: %{+2006-01-02}
func FormatWithEnv ¶
FormatWithEnv format string with environment value, ex: %{HOSTNAME}
func FormatWithEventTime ¶
FormatWithEventTime format string with event time, ex: %{+@2006-01-02}
Types ¶
type LogEvent ¶
type LogEvent struct { Timestamp time.Time `json:"timestamp"` Message string `json:"message"` Tags []string `json:"tags,omitempty"` Extra map[string]any `json:"-"` Drop bool }
func (LogEvent) Format ¶
Format return string with current time / LogEvent field / ENV, ex: %{hostname}
func (LogEvent) MarshalIndent ¶
func (LogEvent) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.