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.
Well, with the recent changes it now works without the time.After() call.
 Insert head in door.  Bang door.  Repeat.




On Wed, Jul 30, 2014 at 10:21 AM, Peter Bourgon <notifications@github.com>
wrote:

> In harpoon-agent/logs_test.go:
>
> > +	if msg != expected {
> > +		t.Errorf("Received %q when expecting %q", msg, expected)
> > +	}
> > +}
> > +
> > +func ExpectNoMessage(t *testing.T, logSink chan string) {
> > +	select {
> > +	case msg := <-logSink:
> > +		t.Errorf("Received log line %q when we should have received nothing", msg)
> > +		// Don't block test suite, while conveniently forcing a context switch so that the
> > +		// results have time to propogate.
> > +	case <-time.After(time.Millisecond):
> > +		t.Errorf("Something blocked that should not have")
> > +	default:
> > +		// Happy path!
> > +	}
>
> Hmm. My feeling is that it's better to make that context switch explicit
> with a time.Sleep or runtime.Gosched in the appropriate place. But, YMMV.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/soundcloud/harpoon/pull/13/files#r15571167>.
>