WriteLogEntry writes a single log line synchronously, implementing SyncDriver. Writing inline (rather than over a channel consumed by Process) ensures a container's final output is durable before containerd tears the logging process down on exit. https://github.com/containerd/nerdctl/issues/5006
(stream, line string)
| 133 | // container's final output is durable before containerd tears the logging |
| 134 | // process down on exit. https://github.com/containerd/nerdctl/issues/5006 |
| 135 | func (jsonLogger *JSONLogger) WriteLogEntry(stream, line string) error { |
| 136 | return jsonLogger.encoder.Encode(stream, line) |
| 137 | } |
| 138 | |
| 139 | func (jsonLogger *JSONLogger) PostProcess() error { |
| 140 | return nil |