From 8c78449a9ef8f2a77cc1ff94f9a0a3178af21408 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Thu, 19 Oct 2017 13:59:02 +0300 Subject: cmd/puppeth: reorganize stats reports to make it readable --- cmd/puppeth/module_dashboard.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmd/puppeth/module_dashboard.go') diff --git a/cmd/puppeth/module_dashboard.go b/cmd/puppeth/module_dashboard.go index 1cf6cab79..7d01f6f0a 100644 --- a/cmd/puppeth/module_dashboard.go +++ b/cmd/puppeth/module_dashboard.go @@ -22,6 +22,7 @@ import ( "html/template" "math/rand" "path/filepath" + "strconv" "strings" "github.com/ethereum/go-ethereum/log" @@ -499,9 +500,13 @@ type dashboardInfos struct { port int } -// String implements the stringer interface. -func (info *dashboardInfos) String() string { - return fmt.Sprintf("host=%s, port=%d", info.host, info.port) +// Report converts the typed struct into a plain string->string map, cotnaining +// most - but not all - fields for reporting to the user. +func (info *dashboardInfos) Report() map[string]string { + return map[string]string{ + "Website address": info.host, + "Website listener port": strconv.Itoa(info.port), + } } // checkDashboard does a health-check against a dashboard container to verify if -- cgit