Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lukanus committed Sep 5, 2023
1 parent fa57cfd commit cc830d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/dreamboat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func main() {
return
}

simFallb := fallback.NewFallback()
simFallb := fallback.NewFallback(logger)
simFallb.AttachMetrics(m)

simManager := sim.NewManager(logger, simFallb)
Expand Down
13 changes: 11 additions & 2 deletions sim/client/fallback/fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"errors"

"github.com/lthibault/log"

sim "github.com/blocknative/dreamboat/sim/client"
"github.com/blocknative/dreamboat/sim/client/types"
)
Expand All @@ -14,10 +16,14 @@ type Fallback struct {
clientsHTTP []sim.Client
atLeastOne bool
m Metrics

l log.Logger
}

func NewFallback() *Fallback {
f := &Fallback{}
func NewFallback(l log.Logger) *Fallback {
f := &Fallback{
l: l,
}
f.initMetrics()
return f
}
Expand Down Expand Up @@ -117,6 +123,7 @@ func (f *Fallback) validateBlock(ctx context.Context, c sim.Client, block *types
return err, false
}

f.l.With(log.F{"node": node}).WithError(err).Warn("validation fallback")
f.m.ServedFrom.WithLabelValues(c.Kind(), node, "fallback").Inc()
return err, true
}
Expand Down Expand Up @@ -169,6 +176,8 @@ func (f *Fallback) validateBlockV2(ctx context.Context, c sim.Client, block *typ
return err, false
}

f.l.With(log.F{"node": node}).WithError(err).Warn("validation fallback")

f.m.ServedFrom.WithLabelValues(c.Kind(), node, "fallback").Inc()
return err, true
}

0 comments on commit cc830d0

Please sign in to comment.