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.
Good catch.  I had already moved it to loop, but I hadn't removed it from
here.  Thanks.


On Wed, Jul 30, 2014 at 5:57 PM, Bernerd Schaefer <notifications@github.com>
wrote:

> In harpoon-agent/logs.go:
>
> > +// The caller can subsequently use the ListenerID to remove the subscription.
> > +func (cl *containerLog) Listen(logSink chan string) ListenerID {
> > +	msg := logListen{logSink: logSink, listenerIDResult: make(chan ListenerID)}
> > +	cl.listenc <- msg
> > +	return <- msg.listenerIDResult
> > +}
> > +
> > +// Unlisten removes a listener from a container's log.  The ListenerID was
> > +// obtained when the client called Listen().
> > +func (cl *containerLog) Unlisten(listenerID ListenerID) {
> > +	cl.unlistenc <- logUnlisten{listenerID: listenerID}
> > +}
> > +
> > +// Exit causes cleans out all the listeners and terminates the loop()
> > +func (cl *containerLog) Exit() {
> > +	cl.removeListeners()
>
> The loop should handle the listener removal on closing of quitc.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/soundcloud/harpoon/pull/13/files#r15593055>.
>