hide domain if only single host in config. (#80)

* hide domain if only single host in config.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* fix host

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* refactor

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-05-10 21:17:31 +08:00 committed by GitHub
parent efdac217bd
commit 1637772e0b

View File

@ -40,7 +40,11 @@ type (
)
func (p Plugin) log(host string, message ...interface{}) {
fmt.Printf("%s: %s", host, fmt.Sprintln(message...))
if count := len(p.Config.Host); count == 1 {
fmt.Printf("%s", fmt.Sprintln(message...))
} else {
fmt.Printf("%s: %s", host, fmt.Sprintln(message...))
}
}
// Exec executes the plugin.