Skip to content

Commit 02fcde0

Browse files
dmcgowanthaJeztah
authored andcommitted
Add separate const for daemon httputils to avoid jsonmessage import
Signed-off-by: Derek McGowan <[email protected]>
1 parent 2574c2b commit 02fcde0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

daemon/server/httputils/write_log_stream.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import (
1010

1111
"github.com/docker/docker/daemon/server/backend"
1212
"github.com/docker/docker/pkg/ioutils"
13-
"github.com/docker/docker/pkg/jsonmessage"
1413
"github.com/moby/moby/api/stdcopy"
1514
"github.com/moby/moby/api/types/container"
1615
)
1716

17+
// rfc3339NanoFixed is time.RFC3339Nano with nanoseconds padded using zeros to
18+
// ensure the formatted time isalways the same number of characters.
19+
const rfc3339NanoFixed = "2006-01-02T15:04:05.000000000Z07:00"
20+
1821
// WriteLogStream writes an encoded byte stream of log messages from the
1922
// messages channel, multiplexing them with a stdcopy.Writer if mux is true
2023
func WriteLogStream(_ context.Context, w http.ResponseWriter, msgs <-chan *backend.LogMessage, config *container.LogsOptions, mux bool) {
@@ -53,7 +56,7 @@ func WriteLogStream(_ context.Context, w http.ResponseWriter, msgs <-chan *backe
5356
logLine = append(logLine, msg.Line...)
5457
}
5558
if config.Timestamps {
56-
logLine = append([]byte(msg.Timestamp.Format(jsonmessage.RFC3339NanoFixed)+" "), logLine...)
59+
logLine = append([]byte(msg.Timestamp.Format(rfc3339NanoFixed)+" "), logLine...)
5760
}
5861
if msg.Source == "stdout" && config.ShowStdout {
5962
_, _ = outStream.Write(logLine)

0 commit comments

Comments
 (0)