use formatted logger in all packages
This commit is contained in:
parent
cb0a7d3cc4
commit
9225619434
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/status-im/status-go/smartcard/apdu"
|
||||
"github.com/status-im/status-go/smartcard/globalplatform"
|
||||
"github.com/status-im/status-go/smartcard/hexutils"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -174,7 +173,7 @@ func (i *Installer) installApplet(capFile *os.File) (*Secrets, error) {
|
|||
|
||||
for load.Next() {
|
||||
cmd := load.GetCommand()
|
||||
_, err = i.send(fmt.Sprintf("load %d", load.Index()), cmd)
|
||||
_, err = i.send(fmt.Sprintf("load %d of 32", load.Index()), cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -199,7 +198,7 @@ func (i *Installer) installApplet(capFile *os.File) (*Secrets, error) {
|
|||
}
|
||||
|
||||
func (i *Installer) send(description string, cmd *apdu.Command, allowedResponses ...uint16) (*apdu.Response, error) {
|
||||
fmt.Printf("-------------------------\nsending %s\n", description)
|
||||
logger.Debug("sending apdu command", "name", description)
|
||||
resp, err := i.c.Send(cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -225,7 +224,3 @@ func generateHostChallenge() ([]byte, error) {
|
|||
_, err := rand.Read(c)
|
||||
return c, err
|
||||
}
|
||||
|
||||
func l(message string, raw []byte) {
|
||||
fmt.Printf("%s %s\n", message, hexutils.BytesToHexWithSpaces(raw))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package lightwallet
|
||||
|
||||
import "github.com/ethereum/go-ethereum/log"
|
||||
|
||||
var logger = log.New("package", "status-go/smartcard/lightwallet")
|
|
@ -1,8 +1,6 @@
|
|||
package lightwallet
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/status-im/status-go/smartcard/apdu"
|
||||
"github.com/status-im/status-go/smartcard/globalplatform"
|
||||
"github.com/status-im/status-go/smartcard/hexutils"
|
||||
|
@ -26,12 +24,12 @@ func (c *NormalChannel) Send(cmd *apdu.Command) (*apdu.Response, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Printf("COMMAND %s\n", hexutils.BytesToHexWithSpaces(rawCmd))
|
||||
logger.Debug("apdu command", "hex", hexutils.BytesToHexWithSpaces(rawCmd))
|
||||
rawResp, err := c.t.Transmit(rawCmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Printf("RESPONSE %s\n", hexutils.BytesToHexWithSpaces(rawResp))
|
||||
logger.Debug("apdu response", "hex", hexutils.BytesToHexWithSpaces(rawResp))
|
||||
|
||||
resp, err := apdu.ParseResponse(rawResp)
|
||||
if err != nil {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package lightwallet
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/status-im/status-go/smartcard/apdu"
|
||||
"github.com/status-im/status-go/smartcard/globalplatform"
|
||||
"github.com/status-im/status-go/smartcard/hexutils"
|
||||
|
@ -28,7 +26,7 @@ func (c *SecureChannel) Send(cmd *apdu.Command) (*apdu.Response, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
fmt.Printf("WRAPPING %s\n", hexutils.BytesToHexWithSpaces(rawCmd))
|
||||
logger.Debug("wrapping apdu command", "hex", hexutils.BytesToHexWithSpaces(rawCmd))
|
||||
wrappedCmd, err := c.w.Wrap(cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue