Copier can copy logs from specified sources to Logger and attach Timestamp. Writes are concurrent, so you need implement some sync in your logger.
| 25 | // Copier can copy logs from specified sources to Logger and attach Timestamp. |
| 26 | // Writes are concurrent, so you need implement some sync in your logger. |
| 27 | type Copier struct { |
| 28 | // srcs is map of name -> reader pairs, for example "stdout", "stderr" |
| 29 | srcs map[string]io.Reader |
| 30 | dst Logger |
| 31 | copyJobs sync.WaitGroup |
| 32 | closeOnce sync.Once |
| 33 | closed chan struct{} |
| 34 | } |
| 35 | |
| 36 | // NewCopier creates a new Copier |
| 37 | func NewCopier(srcs map[string]io.Reader, dst Logger) *Copier { |
nothing calls this directly
no outgoing calls
no test coverage detected