[#25] Use printVerbose wrapper for one-line messages

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-14 15:36:27 +03:00 committed by Alex Vanin
parent 53f7b58130
commit d83411016a

View file

@ -101,7 +101,7 @@ func initConfig() {
// If a config file is found, read it in. // If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil { if err := viper.ReadInConfig(); err == nil {
fmt.Println("Using config file:", viper.ConfigFileUsed()) printVerbose("Using config file: %s", viper.ConfigFileUsed())
} }
} }
@ -116,9 +116,7 @@ func getKey() (*ecdsa.PrivateKey, error) {
return nil, errCantGenerateKey return nil, errCantGenerateKey
} }
if verbose { printVerbose("Generating private key:", hex.EncodeToString(buf))
fmt.Println("Generating private key:", hex.EncodeToString(buf))
}
return crypto.UnmarshalPrivateKey(buf) return crypto.UnmarshalPrivateKey(buf)
} }
@ -182,3 +180,9 @@ func ownerFromString(s string) (*owner.ID, error) {
return id, nil return id, nil
} }
func printVerbose(format string, a ...interface{}) {
if verbose {
fmt.Printf(format+"\n", a...)
}
}