@@ -10,39 +10,35 @@ import (
1010
1111// LogFailedTx takes the transaction and the messages to create it and logs the appropriate data
1212func (c * Chain ) LogFailedTx (res * sdk.TxResponse , err error , msgs []sdk.Msg ) {
13+ logger := GetChainLogger ()
1314 if c .debug {
14- c . Log ( fmt . Sprintf ( "- [%s] -> sending transaction: " , c .ChainID () ))
15+ logger . Info ( "sending-tx" , "chain-id " , c .ChainID ())
1516 for _ , msg := range msgs {
1617 c .Print (msg , false , false )
1718 }
1819 }
1920
2021 if err != nil {
21- c . logger .Error (fmt . Errorf ( "- [%s] -> err(%v) " , c .ChainID (), err ). Error ())
22+ logger .Error ("failed-tx" , err , "chain-id " , c .ChainID ())
2223 if res == nil {
2324 return
2425 }
2526 }
2627
2728 if res .Code != 0 && res .Codespace != "" {
28- c .logger .Info (fmt .Sprintf ("✘ [%s]@{%d} - msg(%s) err(%s:%d:%s)" ,
29- c .ChainID (), res .Height , getMsgAction (msgs ), res .Codespace , res .Code , res .RawLog ))
29+ logger .Info ("res" , "chain-id" , c .ChainID (), "height" , res .Height , "action" , getMsgAction (msgs ), "codespace" , res .Codespace , "code" , res .Code , "raw-log" , res .RawLog )
3030 }
3131
3232 if c .debug && ! res .Empty () {
33- c . Log ( "- transaction response:" )
33+ logger . Info ( "tx-response" , "chain-id" , c . ChainID (), "res" , res )
3434 c .Print (res , false , false )
3535 }
3636}
3737
3838// LogSuccessTx take the transaction and the messages to create it and logs the appropriate data
3939func (c * Chain ) LogSuccessTx (res * sdk.TxResponse , msgs []sdk.Msg ) {
40- c .logger .Info (fmt .Sprintf ("✔ [%s]@{%d} - msg(%s) hash(%s)" , c .ChainID (), res .Height , getMsgAction (msgs ), res .TxHash ))
41- }
42-
43- // Log takes a string and logs the data
44- func (c * Chain ) Log (s string ) {
45- c .logger .Info (s )
40+ logger := GetChainLogger ()
41+ logger .Info ("success-tx" , "chain-id" , c .ChainID (), "height" , res .Height , "hash" , res .TxHash )
4642}
4743
4844// Print fmt.Printlns the json or yaml representation of whatever is passed in
0 commit comments