Encode writes a single log entry for the given stream.
(stream, line string)
| 58 | |
| 59 | // Encode writes a single log entry for the given stream. |
| 60 | func (s *SyncEncoder) Encode(stream, line string) error { |
| 61 | s.mu.Lock() |
| 62 | defer s.mu.Unlock() |
| 63 | return s.enc.Encode(&Entry{ |
| 64 | Stream: stream, |
| 65 | Log: line, |
| 66 | Time: time.Now().UTC(), |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | func Encode(stdout <-chan string, stderr <-chan string, writer io.Writer) error { |
| 71 | enc := json.NewEncoder(writer) |
no test coverage detected