(appGUID string, onConnect func(), logChan chan<- Loggable, errChan chan<- error)
| 52 | } |
| 53 | |
| 54 | func (r *logCacheRepository) TailLogsFor(appGUID string, onConnect func(), logChan chan<- Loggable, errChan chan<- error) { |
| 55 | messages, logErrs, stopStreaming := r.getStreamingLogsFunc(appGUID, r.client) |
| 56 | |
| 57 | r.cancelFunc = stopStreaming |
| 58 | |
| 59 | defer close(logChan) |
| 60 | defer close(errChan) |
| 61 | |
| 62 | for { |
| 63 | select { |
| 64 | case message, ok := <-messages: |
| 65 | if !ok { |
| 66 | return |
| 67 | } |
| 68 | logChan <- NewLogCacheMessage(&terminalColorLogger{}, message) |
| 69 | case logErr, ok := <-logErrs: |
| 70 | if !ok { |
| 71 | return |
| 72 | } |
| 73 | errChan <- logErr |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | func (r *logCacheRepository) Close() { |
| 79 | r.cancelFunc() |
nothing calls this directly
no test coverage detected