(stdout, stderr io.Writer, r io.Reader, timestamps bool, since string, until string)
| 153 | } |
| 154 | |
| 155 | func 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 | } |
no test coverage detected
searching dependent graphs…