Skip to content

Commit

Permalink
fix error logging
Browse files Browse the repository at this point in the history
`Error(msg,err)` -> `Error(msg,"error",err)`

fixes #98
  • Loading branch information
boz committed Mar 27, 2018
1 parent eecf4c1 commit 696497e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/market/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (d *driver) watchContext() {
defer d.wg.Done()
<-d.ctx.Done()
if err := d.unsubscribe(); err != nil {
d.log.Error("unsubscribing", err)
d.log.Error("unsubscribing", "error", err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/market/facilitator.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (f *facilitator) Run(state state.State) error {

for _, tx := range txs {
if _, err := sender.Send(tx); err != nil {
f.log.Error("Error sending transaction", err)
f.log.Error("Error sending transaction", "error", err)
return err
}
}
Expand All @@ -60,7 +60,7 @@ func (f *facilitator) Run(state state.State) error {
func (f *facilitator) currentNonce(state state.State) (uint64, error) {
account, err := state.Account().Get(f.actor.Address())
if err != nil {
f.log.Error("Facilitator does not have an account.", err)
f.log.Error("Facilitator does not have an account.", "error", err)
return 0, err
}
if account == nil {
Expand Down
12 changes: 6 additions & 6 deletions cmd/akash/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ func createDeployment(ctx context.Context, cmd *cobra.Command, args []string) er

res, err := ctx.Client().BroadcastTxCommit(tx)
if err != nil {
ctx.Log().Error("error sending tx", err)
ctx.Log().Error("error sending tx", "error", err)
return err
}
if !res.CheckTx.IsOK() {
ctx.Log().Error("error delivering tx", "err", res.CheckTx.GetLog())
ctx.Log().Error("error delivering tx", "error", res.CheckTx.GetLog())
return errors.New(res.CheckTx.GetLog())
}
if !res.DeliverTx.IsOK() {
ctx.Log().Error("error delivering tx", "err", res.DeliverTx.GetLog())
ctx.Log().Error("error delivering tx", "error", res.DeliverTx.GetLog())
return errors.New(res.DeliverTx.GetLog())
}
fmt.Printf("Created deployment: %X\n", deployment.Address)
Expand Down Expand Up @@ -142,15 +142,15 @@ func closeDeployment(ctx context.Context, cmd *cobra.Command, args []string) err

res, err := ctx.Client().BroadcastTxCommit(tx)
if err != nil {
ctx.Log().Error("error sending tx", err)
ctx.Log().Error("error sending tx", "error", err)
return err
}
if !res.CheckTx.IsOK() {
ctx.Log().Error("error delivering tx", "err", res.CheckTx.GetLog())
ctx.Log().Error("error delivering tx", "error", res.CheckTx.GetLog())
return errors.New(res.CheckTx.GetLog())
}
if !res.DeliverTx.IsOK() {
ctx.Log().Error("error delivering tx", "err", res.DeliverTx.GetLog())
ctx.Log().Error("error delivering tx", "error", res.DeliverTx.GetLog())
return errors.New(res.DeliverTx.GetLog())
}

Expand Down
12 changes: 6 additions & 6 deletions cmd/akash/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ func doProviderRunCommand(ctx context.Context, cmd *cobra.Command, args []string

nonce, err := ctx.Nonce()
if err != nil {
ctx.Log().Error("error getting nonce", err)
ctx.Log().Error("error getting nonce", "error", err)
return
}

price, err := getPrice(ctx, tx.Order.Deployment, tx.Order.Group)
if err != nil {
ctx.Log().Error("error getting price", err)
ctx.Log().Error("error getting price", "error", err)
return
}

Expand All @@ -195,21 +195,21 @@ func doProviderRunCommand(ctx context.Context, cmd *cobra.Command, args []string

txbuf, err := txutil.BuildTx(signer, nonce, ordertx)
if err != nil {
ctx.Log().Error("error building tx", err)
ctx.Log().Error("error building tx", "error", err)
return
}

resp, err := client.BroadcastTxCommit(txbuf)
if err != nil {
ctx.Log().Error("error broadcasting tx", err)
ctx.Log().Error("error broadcasting tx", "error", err)
return
}
if resp.CheckTx.IsErr() {
ctx.Log().Error("CheckTx error", "err", resp.CheckTx.Log)
ctx.Log().Error("CheckTx error", "error", resp.CheckTx.Log)
return
}
if resp.DeliverTx.IsErr() {
ctx.Log().Error("DeliverTx error", "err", resp.DeliverTx.Log)
ctx.Log().Error("DeliverTx error", "error", resp.DeliverTx.Log)
return
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/common/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func doMonitorMarketplace(ctx context.Context, log log.Logger, client *tmclient.
}()

if err := client.Start(); err != nil {
log.Error("error starting ws client", err)
log.Error("error starting ws client", "error", err)
return err
}

Expand Down
2 changes: 1 addition & 1 deletion marketplace/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (m *monitor) runListener(ch <-chan interface{}, h Handler) {

tx, err := txutil.ProcessTx(evt.Tx)
if err != nil {
m.log.Error("ProcessTx", "err", err)
m.log.Error("ProcessTx", "error", err)
continue
}

Expand Down

0 comments on commit 696497e

Please sign in to comment.