summaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/http.go b/http.go
index 2188ed5..e4c9401 100644
--- a/http.go
+++ b/http.go
@@ -4,8 +4,10 @@ import (
"fmt"
"net/http"
"strings"
+ "time"
"go.wit.com/log"
+ "go.wit.com/lib/gui/shell"
)
// remove '?' part and trailing '/'
@@ -18,7 +20,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
var tmp string
tmp = cleanURL(r.URL.Path)
- log.Info("Got URL:", tmp)
+ log.Info("Handling URL:", tmp)
if tmp == "/" {
fmt.Fprintln(w, "OK")
return
@@ -30,7 +32,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
if tmp == "/vms" {
for _, d := range me.droplets {
- fmt.Fprintln(w, d.Hostname, d.hname, d.lastpoll)
+ dur := time.Since(d.lastpoll) // Calculate the elapsed time
+ fmt.Fprintln(w, d.Hostname, d.hname, shell.FormatDuration(dur))
}
return
}