11package tendermint
22
33import (
4+ "context"
45 "fmt"
56 "strings"
67
@@ -9,36 +10,36 @@ import (
910)
1011
1112// LogFailedTx takes the transaction and the messages to create it and logs the appropriate data
12- func (c * Chain ) LogFailedTx (res * sdk.TxResponse , err error , msgs []sdk.Msg ) {
13+ func (c * Chain ) LogFailedTx (ctx context. Context , res * sdk.TxResponse , err error , msgs []sdk.Msg ) {
1314 logger := GetChainLogger ()
1415 if c .debug {
15- logger .Info ( "sending-tx" , "chain-id" , c .ChainID ())
16+ logger .InfoContext ( ctx , "sending-tx" , "chain-id" , c .ChainID ())
1617 for _ , msg := range msgs {
1718 c .Print (msg , false , false )
1819 }
1920 }
2021
2122 if err != nil {
22- logger .Error ( "failed-tx" , err , "chain-id" , c .ChainID ())
23+ logger .ErrorContext ( ctx , "failed-tx" , err , "chain-id" , c .ChainID ())
2324 if res == nil {
2425 return
2526 }
2627 }
2728
2829 if res .Code != 0 && res .Codespace != "" {
29- logger .Info ( "res" , "chain-id" , c .ChainID (), "height" , res .Height , "action" , getMsgAction (msgs ), "codespace" , res .Codespace , "code" , res .Code , "raw-log" , res .RawLog )
30+ logger .InfoContext ( ctx , "res" , "chain-id" , c .ChainID (), "height" , res .Height , "action" , getMsgAction (msgs ), "codespace" , res .Codespace , "code" , res .Code , "raw-log" , res .RawLog )
3031 }
3132
3233 if c .debug && ! res .Empty () {
33- logger .Info ( "tx-response" , "chain-id" , c .ChainID (), "res" , res )
34+ logger .InfoContext ( ctx , "tx-response" , "chain-id" , c .ChainID (), "res" , res )
3435 c .Print (res , false , false )
3536 }
3637}
3738
3839// LogSuccessTx take the transaction and the messages to create it and logs the appropriate data
39- func (c * Chain ) LogSuccessTx (res * sdk.TxResponse , msgs []sdk.Msg ) {
40+ func (c * Chain ) LogSuccessTx (ctx context. Context , res * sdk.TxResponse , msgs []sdk.Msg ) {
4041 logger := GetChainLogger ()
41- logger .Info ( "success-tx" , "chain-id" , c .ChainID (), "height" , res .Height , "hash" , res .TxHash )
42+ logger .InfoContext ( ctx , "success-tx" , "chain-id" , c .ChainID (), "height" , res .Height , "hash" , res .TxHash )
4243}
4344
4445// Print fmt.Printlns the json or yaml representation of whatever is passed in
0 commit comments