Add functions for structured progress logging
This commit is contained in:
parent
58e452ea4e
commit
e852713ed7
5 changed files with 54 additions and 7 deletions
|
|
@ -82,7 +82,7 @@ var NettestGroups = map[string]NettestGroup{
|
|||
return string(summaryBytes), nil
|
||||
},
|
||||
},
|
||||
"middleboxes": NettestGroup{
|
||||
"middlebox": NettestGroup{
|
||||
Label: "Middleboxes",
|
||||
Nettests: []nettests.Nettest{
|
||||
middlebox.HTTPInvalidRequestLine{},
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package nettests
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/measurement-kit/go-measurement-kit"
|
||||
|
|
@ -9,6 +10,7 @@ import (
|
|||
"github.com/openobservatory/gooni/internal/cli/version"
|
||||
"github.com/openobservatory/gooni/internal/colors"
|
||||
"github.com/openobservatory/gooni/internal/database"
|
||||
"github.com/openobservatory/gooni/internal/output"
|
||||
)
|
||||
|
||||
// Nettest interface. Every Nettest should implement this.
|
||||
|
|
@ -176,6 +178,9 @@ func (c *Controller) Init(nt *mk.Nettest) error {
|
|||
// OnProgress should be called when a new progress event is available.
|
||||
func (c *Controller) OnProgress(perc float64, msg string) {
|
||||
log.Debugf("OnProgress: %f - %s", perc, msg)
|
||||
|
||||
key := fmt.Sprintf("%T", c.nt)
|
||||
output.Progress(key, perc, msg)
|
||||
}
|
||||
|
||||
// Entry is an opaque measurement entry
|
||||
|
|
|
|||
Loading…
Reference in a new issue