jsonlog.go 626 B

12345678910111213141516171819202122232425
  1. package jsonlog
  2. import (
  3. "time"
  4. )
  5. // JSONLog is a log message, typically a single entry from a given log stream.
  6. type JSONLog struct {
  7. // Log is the log message
  8. Log string `json:"log,omitempty"`
  9. // Stream is the log source
  10. Stream string `json:"stream,omitempty"`
  11. // Created is the created timestamp of log
  12. Created time.Time `json:"time"`
  13. // Attrs is the list of extra attributes provided by the user
  14. Attrs map[string]string `json:"attrs,omitempty"`
  15. }
  16. // Reset all fields to their zero value.
  17. func (jl *JSONLog) Reset() {
  18. jl.Log = ""
  19. jl.Stream = ""
  20. jl.Created = time.Time{}
  21. jl.Attrs = make(map[string]string)
  22. }