 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package loggregator_consumer provides a simple, channel-based API for clients to communicate with loggregator servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
var ( // KeepAlive sets the interval between keep-alive messages sent by the client to loggregator. KeepAlive = 25 * time.Second ErrNotFound = errors.New("/recent path not found or has issues") ErrBadResponse = errors.New("bad server response") ErrBadRequest = errors.New("bad client request") )
Functions ¶
func SortRecent ¶
func SortRecent(messages []*logmessage.LogMessage) []*logmessage.LogMessage
SortRecent sorts a slice of LogMessages by timestamp. The sort is stable, so messages with the same timestamp are sorted in the order that they are received.
The input slice is sorted; the return value is simply a pointer to the same slice.
Types ¶
type DebugPrinter ¶
type DebugPrinter interface {
	Print(title, dump string)
}
    type LoggregatorConsumer ¶
type LoggregatorConsumer interface {
	//	Tail listens indefinitely for log messages. It returns two channels; the first is populated
	//	with log messages, while the second contains errors (e.g. from parsing messages). It returns
	//	immediately. Call Close() to terminate the connection when you are finished listening.
	//
	//	Messages are presented in the order received from the loggregator server. Chronological or
	//	other ordering is not guaranteed. It is the responsibility of the consumer of these channels
	//	to provide any desired sorting mechanism.
	Tail(appGuid string, authToken string) (<-chan *logmessage.LogMessage, error)
	//	Recent connects to loggregator via its 'recent' endpoint and returns a slice of recent messages.
	//	It does not guarantee any order of the messages; they are in the order returned by loggregator.
	//
	//	The SortRecent method is provided to sort the data returned by this method.
	Recent(appGuid string, authToken string) ([]*logmessage.LogMessage, error)
	// Close terminates the websocket connection to loggregator.
	Close() error
	// SetOnConnectCallback sets a callback function to be called with the websocket connection is established.
	SetOnConnectCallback(func())
	// SetDebugPrinter enables logging of the websocket handshake
	SetDebugPrinter(DebugPrinter)
}
    LoggregatorConsumer represents the actions that can be performed against a loggregator server.
 Click to show internal directories. 
   Click to hide internal directories. 

