forked from TrueCloudLab/frostfs-node
[#25] Use printVerbose
wrapper for one-line messages
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
53f7b58130
commit
d83411016a
1 changed files with 8 additions and 4 deletions
|
@ -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...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue