Logging api

Reviewers:  @bernerdschaefer, @peterbourgon 

First pass at the internals of the logging API.  This is two layers thick.  There is a RingBuffer for log messages, and on top of this is a data structure that implements storage for and operations for each container.  (The RingBuffer probably should have been a separate submit.)

The next piece to be worked on will be the HTTP logging interface.
Done.


On Wed, Jul 30, 2014 at 5:55 PM, Bernerd Schaefer <notifications@github.com>
wrote:

> In harpoon-agent/api.go:
>
> > +	if isStreamAccept(r.Header.Get("Accept")) {
> > +		logLines := make(chan string, 2000)
> > +		listenerID := container.logs.Listen(logLines)
> > +		defer container.logs.Unlisten(listenerID)
> > +		for line := range logLines {
> > +			_, err := w.Write([]byte(line))
> > +			if err != nil {
> > +				return
> > +			}
> > +		}
> > +		return
> > +	}
> > +
> > +	for _, line := range container.logs.Last(history) {
> > +		_, err := w.Write([]byte(line))
> > +		if err != nil {
>
> if _, err := w.Write([]byte(line)); err != nil {
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/soundcloud/harpoon/pull/13/files#r15592861>.
>