MCPcopy Create free account
hub / github.com/containerd/nerdctl / Decode

Function Decode

pkg/logging/jsonfile/jsonfile.go:155–178  ·  view source on GitHub ↗
(stdout, stderr io.Writer, r io.Reader, timestamps bool, since string, until string)

Source from the content-addressed store, hash-verified

153}
154
155func Decode(stdout, stderr io.Writer, r io.Reader, timestamps bool, since string, until string) ([]byte, error) {
156 dec := json.NewDecoder(r)
157 now := time.Now()
158 for {
159 var e Entry
160 if err := dec.Decode(&e); err == io.EOF {
161 break
162 } else if err != nil {
163 line, err := io.ReadAll(dec.Buffered())
164 if err != nil {
165 return nil, err
166 }
167 return line, err
168 }
169
170 // Write out the entry directly
171 err := writeEntry(&e, stdout, stderr, now, timestamps, since, until)
172 if err != nil {
173 log.L.WithError(err).Errorf("error while writing log entry to output stream")
174 }
175 }
176
177 return nil, nil
178}

Callers 1

viewLogsJSONFileDirectFunction · 0.92

Calls 1

writeEntryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…