@@ -30,7 +30,7 @@ func DeleteAccount(homedir, address string) bool {
3030 })
3131
3232 if err != nil && wallet == nil {
33- fmt .Printf ("failed to find account %s, error: %s" , address , err )
33+ Logger. Error ( fmt .Sprintf ("failed to find account %s, error: %s" , address , err )) ``
3434 return false
3535 }
3636
@@ -54,15 +54,17 @@ func AccountExists(homedir, address string) bool {
5454 })
5555
5656 if err != nil && wallet == nil {
57- fmt .Printf ("failed to find account %s, error: %s\n " , address , err )
57+ Logger. Error ( fmt.Sprintf ("failed to find account %s, error: %s" , address , err ) )
5858 return false
5959 }
6060
6161 status , _ := wallet.Status ()
6262 url := wallet.URL ()
6363
64- fmt .Printf ("Account exists. Status: %s, Path: %s\n " , status , url )
65-
64+ Logger.Info (
65+ fmt.Sprintf ("Account exists. Status: %s, Path: %s" , status , url ),
66+ )
67+
6668 return true
6769}
6870
@@ -74,8 +76,10 @@ func CreateKeyStorage(homedir, password string) error {
7476 if err != nil {
7577 return errors.Wrap (err , "failed to create keystore" )
7678 }
77- fmt .Printf ("Created account: %s" , account .Address .Hex ())
78-
79+ Logger.Info (
80+ fmt.Sprintf ("Created account: %s" , account.Address .Hex ( )),
81+ )
82+
7983 return nil
8084}
8185
@@ -140,7 +144,9 @@ func ImportAccount(homedir, mnemonic, password string) (string, error) {
140144 // 3. Find key
141145 acc , err := ks .Find (account )
142146 if err == nil {
143- fmt .Printf ("Account already exists: %s\n Path: %s\n \n " , acc .Address .Hex (), acc .URL .Path )
147+ Logger.Info (
148+ fmt.Sprintf ("Account already exists: %s\n Path: %s\n \n " , acc.Address .Hex (), acc.URL .Path ),
149+ )
144150 return acc .Address .Hex (), nil
145151 }
146152
@@ -150,7 +156,9 @@ func ImportAccount(homedir, mnemonic, password string) (string, error) {
150156 return "" , errors.Wrap (err , "failed to get import private key" )
151157 }
152158
153- fmt .Printf ("Imported account %s to path: %s\n " , acc .Address .Hex (), acc .URL .Path )
154-
159+ Logger.Info (
160+ fmt.Sprintf ("Imported account %s to path: %s\n " , acc.Address .Hex (), acc.URL .Path ),
161+ )
162+
155163 return acc.Address .Hex (), nil
156164}
0 commit comments