From 6dc92bea164ddd38e1b87a3924be86bb07bf4286 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 22 Feb 2023 15:16:47 +0800 Subject: [PATCH] grid2: pass logger entry to debugGrid --- pkg/strategy/grid2/debug.go | 6 ++++-- pkg/strategy/grid2/strategy.go | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/grid2/debug.go b/pkg/strategy/grid2/debug.go index 611c60068..1a57eeb44 100644 --- a/pkg/strategy/grid2/debug.go +++ b/pkg/strategy/grid2/debug.go @@ -4,12 +4,14 @@ import ( "fmt" "strings" + "github.com/sirupsen/logrus" + "github.com/c9s/bbgo/pkg/bbgo" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) -func debugGrid(grid *Grid, book *bbgo.ActiveOrderBook) { +func debugGrid(logger logrus.FieldLogger, grid *Grid, book *bbgo.ActiveOrderBook) { var sb strings.Builder sb.WriteString("================== GRID ORDERS ==================\n") @@ -50,5 +52,5 @@ func debugGrid(grid *Grid, book *bbgo.ActiveOrderBook) { sb.WriteString("================== END OF GRID ORDERS ===================") - fmt.Println(sb.String()) + logger.Infoln(sb.String()) } diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 908ef0b32..f917fe983 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -1223,7 +1223,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService } } - debugGrid(grid, orderBook) + debugGrid(s.logger, grid, orderBook) tmpOrders := orderBook.Orders() @@ -1272,7 +1272,7 @@ func (s *Strategy) recoverGridWithOpenOrders(ctx context.Context, historyService s.logger.Infof("GRID RECOVER COMPLETE") - debugGrid(grid, s.orderExecutor.ActiveMakerOrders()) + debugGrid(s.logger, grid, s.orderExecutor.ActiveMakerOrders()) return nil }