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.
That would be awesome. I was just looking at writing some.

-jeff


On Tue, Jul 29, 2014 at 9:56 PM, Bernerd Schaefer <notifications@github.com>
wrote:

> In harpoon-agent/logs.go:
>
> > +	containerID ContainerID
> > +	entries *RingBuffer
> > +	listeners map[ListenerID]chan string
> > +	nextListenerID ListenerID
> > +}
> > +
> > +func newContainerLog(containerID ContainerID, bufferSize int) *containerLog {
> > +	return &containerLog{containerID: containerID,
> > +		entries: NewRingBuffer(bufferSize),
> > +		listeners: make(map[ListenerID]chan string),
> > +		nextListenerID: 1,
> > +	}
> > +}
> > +
> > +// TODO: Expire old containers
> > +type LogSet struct {
>
> I've got some hooks I've been using. I'll share them / add to the repo.
> Bernerd On Jul 29, 2014, at 21:45, Jeff Younker <notifications@github.com>
> wrote: In harpoon-agent/logs.go:
>  + containerID ContainerID + entries *RingBuffer + listeners
> map[ListenerID]chan string + nextListenerID ListenerID +} + +func
> newContainerLog(containerID ContainerID, bufferSize int) *containerLog { +
> return &containerLog{containerID: containerID, + entries:
> NewRingBuffer(bufferSize), + listeners: make(map[ListenerID]chan string), +
> nextListenerID: 1, + } +} + +// TODO: Expire old containers +type LogSet
> struct {
> Has anyone thought about putting in a pre-submit hook? … <#> On Tue, Jul
> 29, 2014 at 4:18 PM, Peter Bourgon <notifications@github.com> wrote: In
> harpoon-agent/logs.go: > + containerID ContainerID > + entries *RingBuffer
> > + listeners map[ListenerID]chan string > + nextListenerID ListenerID > +}
> > + > +func newContainerLog(containerID ContainerID, bufferSize int)
> *containerLog { > + return &containerLog{containerID: containerID, > +
> entries: NewRingBuffer(bufferSize), > + listeners: make(map[ListenerID]chan
> string), > + nextListenerID: 1, > + } > +} > + > +// TODO: Expire old
> containers > +type LogSet struct { Please configure your toolchain to run
> go vet and golint during your build process. They would catch the error
> here, which is that LogSet should have a comment (since it's an exported
> symbol). — Reply to this email directly or view it on GitHub <
> https://github.com/soundcloud/harpoon/pull/13/files#r15524955>. — Reply
> to this email directly or view it on GitHub <
> https://github.com/soundcloud/harpoon/pull/13/files#r15547228>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/soundcloud/harpoon/pull/13/files#r15547805>.
>