[#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 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
}
if verbose {
fmt.Println("Generating private key:", hex.EncodeToString(buf))
}
printVerbose("Generating private key:", hex.EncodeToString(buf))
return crypto.UnmarshalPrivateKey(buf)
}
@ -182,3 +180,9 @@ func ownerFromString(s string) (*owner.ID, error) {
return id, nil
}
func printVerbose(format string, a ...interface{}) {
if verbose {
fmt.Printf(format+"\n", a...)
}
}