Skip to content

Commit

Permalink
improved chaos logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg committed Aug 30, 2018
1 parent 8f1a6ec commit bb667d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/cmd/roachtest/chaos.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ type Chaos struct {
// setting off the monitor. The process returns without an error after the chaos
// duration.
func (ch *Chaos) Runner(c *cluster, m *monitor) func(context.Context) error {
return func(ctx context.Context) error {
return func(ctx context.Context) (err error) {
l, err := c.l.childLogger("CHAOS")
if err != nil {
return err
}
defer func() {
l.printf("chaos stopping: %v", err)
}()
t := timeutil.Timer{}
// Disaster strikes immediately at first.
t.Reset(time.Nanosecond)
Expand Down Expand Up @@ -94,7 +97,7 @@ func (ch *Chaos) Runner(c *cluster, m *monitor) func(context.Context) error {
return ctx.Err()
case <-time.After(downTime):
}
c.l.printf("restarting %v after %s of downtime\n", target, downTime)
l.printf("restarting %v after %s of downtime\n", target, downTime)
t.Reset(period)
c.Start(ctx, target)
}
Expand Down

0 comments on commit bb667d5

Please sign in to comment.