2018-02-05 16:05:59 -05:00
|
|
|
package jsonlog // import "github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
|
2014-07-30 08:39:03 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2017-09-25 15:52:42 -04:00
|
|
|
// JSONLog is a log message, typically a single entry from a given log stream.
|
2014-07-30 08:39:03 -07:00
|
|
|
type JSONLog struct {
|
2015-08-08 11:28:22 +08:00
|
|
|
// Log is the log message
|
|
|
|
Log string `json:"log,omitempty"`
|
|
|
|
// Stream is the log source
|
|
|
|
Stream string `json:"stream,omitempty"`
|
|
|
|
// Created is the created timestamp of log
|
2014-07-30 08:39:03 -07:00
|
|
|
Created time.Time `json:"time"`
|
2016-04-08 12:15:08 -04:00
|
|
|
// Attrs is the list of extra attributes provided by the user
|
|
|
|
Attrs map[string]string `json:"attrs,omitempty"`
|
2014-07-30 08:39:03 -07:00
|
|
|
}
|
|
|
|
|
2017-09-22 15:59:28 -04:00
|
|
|
// Reset all fields to their zero value.
|
2014-09-18 18:04:18 +03:00
|
|
|
func (jl *JSONLog) Reset() {
|
|
|
|
jl.Log = ""
|
|
|
|
jl.Stream = ""
|
|
|
|
jl.Created = time.Time{}
|
2020-04-08 12:24:31 -07:00
|
|
|
for k := range jl.Attrs {
|
|
|
|
delete(jl.Attrs, k)
|
|
|
|
}
|
2014-09-18 18:04:18 +03:00
|
|
|
}
|