Skip to content

Commit

Permalink
Print descriptions from cli
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkramny committed May 19, 2016
1 parent 9d0e176 commit 5c4f0c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
16 changes: 16 additions & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ func main() {

wg := &sync.WaitGroup{}
for _, mon := range cfg.Monitors {
cfg.Logger.Printf(" Starting %s: %d seconds check interval\n - %v %s", mon.Name, mon.CheckInterval, mon.Method, mon.URL)

// print features
if mon.ExpectedStatusCode > 0 {
cfg.Logger.Printf(" - Expect HTTP %d", mon.ExpectedStatusCode)
}
if len(mon.ExpectedBody) > 0 {
cfg.Logger.Printf(" - Expect Body to match \"%v\"", mon.ExpectedBody)
}
if mon.MetricID > 0 {
cfg.Logger.Printf(" - Log lag to metric id %d\n", mon.MetricID)
}
if mon.ComponentID > 0 {
cfg.Logger.Printf(" - Update component id %d\n\n", mon.ComponentID)
}

go mon.Start(cfg, wg)
}

Expand Down
17 changes: 0 additions & 17 deletions monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@ func (mon *Monitor) Start(cfg *CachetMonitor, wg *sync.WaitGroup) {
wg.Add(1)
mon.config = cfg
mon.stopC = make(chan bool)

mon.config.Logger.Printf(" Starting %s: %d seconds check interval\n - %v %s", mon.Name, mon.CheckInterval, mon.Method, mon.URL)

// print features
if mon.ExpectedStatusCode > 0 {
mon.config.Logger.Printf(" - Expect HTTP %d", mon.ExpectedStatusCode)
}
if len(mon.ExpectedBody) > 0 {
mon.config.Logger.Printf(" - Expect Body to match \"%v\"", mon.ExpectedBody)
}
if mon.MetricID > 0 {
mon.config.Logger.Printf(" - Log lag to metric id %d\n", mon.MetricID)
}
if mon.ComponentID > 0 {
mon.config.Logger.Printf(" - Update component id %d\n\n", mon.ComponentID)
}

mon.Tick()

ticker := time.NewTicker(mon.CheckInterval * time.Second)
Expand Down

0 comments on commit 5c4f0c2

Please sign in to comment.