Skip to content

Commit

Permalink
go txsource: separate workloads' log tags
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Dec 30, 2019
1 parent 88a3df1 commit c75d178
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ import (

"google.golang.org/grpc"

"github.com/oasislabs/oasis-core/go/common/logging"
consensus "github.com/oasislabs/oasis-core/go/consensus/api"
runtimeClient "github.com/oasislabs/oasis-core/go/runtime/client/api"
)

var _ Workload = runtimePlaceholder{}
var (
_ Workload = runtimePlaceholder{}

runtimePlaceholderLogger = logging.GetLogger("cmd/txsource/workload/runtimeplaceholder")
)

type runtimePlaceholder struct{}

Expand All @@ -23,6 +28,6 @@ func (runtimePlaceholder) Run(_ context.Context, _ *rand.Rand, _ *grpc.ClientCon
if err != nil {
return fmt.Errorf("rtc.SubmitTx: %w", err)
}
logger.Debug("output", "out", out)
runtimePlaceholderLogger.Debug("output", "out", out)
return nil
}
8 changes: 4 additions & 4 deletions go/oasis-node/cmd/debug/txsource/workload/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
TransferAmount = 1
)

var logger = logging.GetLogger("cmd/txsource/workload/transfer")
var transferLogger = logging.GetLogger("cmd/txsource/workload/transfer")

type transfer struct{}

Expand Down Expand Up @@ -56,7 +56,7 @@ func (transfer) Run(gracefulExit context.Context, rng *rand.Rand, conn *grpc.Cli
if err != nil {
return fmt.Errorf("stakingClient.AccountInfo %s: %w", accounts[i].signer.Public(), err)
}
logger.Debug("account info",
transferLogger.Debug("account info",
"i", i,
"pub", accounts[i].signer.Public(),
"info", account,
Expand Down Expand Up @@ -101,7 +101,7 @@ func (transfer) Run(gracefulExit context.Context, rng *rand.Rand, conn *grpc.Cli
if err != nil {
return fmt.Errorf("transaction.Sign: %w", err)
}
logger.Debug("submitting transfer",
transferLogger.Debug("submitting transfer",
"from", from.signer.Public(),
"to", to.signer.Public(),
)
Expand All @@ -121,7 +121,7 @@ func (transfer) Run(gracefulExit context.Context, rng *rand.Rand, conn *grpc.Cli

select {
case <-gracefulExit.Done():
logger.Debug("time's up")
transferLogger.Debug("time's up")
return nil
default:
}
Expand Down

0 comments on commit c75d178

Please sign in to comment.