github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/cf/api/logs/logs_repository.go (about)

     1  package logs
     2  
     3  import "time"
     4  
     5  //go:generate counterfeiter . Loggable
     6  type Loggable interface {
     7  	ToLog(loc *time.Location) string
     8  	ToSimpleLog() string
     9  	GetSourceName() string
    10  }
    11  
    12  //go:generate counterfeiter . Repository
    13  
    14  type Repository interface {
    15  	RecentLogsFor(appGUID string) ([]Loggable, error)
    16  	TailLogsFor(appGUID string, onConnect func(), logChan chan<- Loggable, errChan chan<- error)
    17  	Close()
    18  }
    19  
    20  const defaultBufferTime time.Duration = 25 * time.Millisecond
    21  
    22  func max(a, b int) int {
    23  	if a > b {
    24  		return a
    25  	}
    26  	return b
    27  }