Skip to content

Commit

Permalink
use existing logger instead of adding new one
Browse files Browse the repository at this point in the history
  • Loading branch information
shahbazn committed Nov 29, 2023
1 parent 016783a commit eaecb18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

log "github.com/archway-network/relayer_exporter/pkg/logger"
"github.com/cosmos/relayer/v2/relayer"
"github.com/cosmos/relayer/v2/relayer/chains/cosmos"
"go.uber.org/zap"
)

const (
Expand All @@ -22,8 +22,6 @@ type Info struct {
}

func PrepChain(info Info) (*relayer.Chain, error) {
logger := zap.NewNop()

timeout := rpcTimeout
if info.Timeout != "" {
timeout = info.Timeout
Expand All @@ -46,7 +44,7 @@ func PrepChain(info Info) (*relayer.Chain, error) {
return nil, err
}

chain := relayer.NewChain(logger, provider, false)
chain := relayer.NewChain(log.GetLogger(), provider, false)

err = chain.SetPath(&relayer.PathEnd{ClientID: info.ClientID})
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ func init() {
logger.Level()
}

func GetLogger() *zap.Logger {
return logger
}

func Info(message string, fields ...zap.Field) {
logger.Info(message, fields...)
}
Expand Down

0 comments on commit eaecb18

Please sign in to comment.