MCPcopy Index your code
hub / github.com/cloudfoundry/cli / TailLogsFor

Method TailLogsFor

cf/api/logs/log_cache_repository.go:54–76  ·  view source on GitHub ↗
(appGUID string, onConnect func(), logChan chan<- Loggable, errChan chan<- error)

Source from the content-addressed store, hash-verified

52}
53
54func (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
78func (r *logCacheRepository) Close() {
79 r.cancelFunc()

Callers

nothing calls this directly

Calls 1

NewLogCacheMessageFunction · 0.85

Tested by

no test coverage detected