jsonlog.go 713 B

123456789101112131415161718192021222324252627
  1. package jsonlog // import "github.com/docker/docker/daemon/logger/jsonfilelog/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. for k := range jl.Attrs {
  22. delete(jl.Attrs, k)
  23. }
  24. }