System logger
This commit is contained in:
12
main.go
12
main.go
@@ -1,24 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/castawaylabs/cachet-monitor/cachet"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
config := cachet.Config
|
||||
log := cachet.Logger
|
||||
|
||||
fmt.Printf("System: %s, API: %s\n", config.SystemName, config.APIUrl)
|
||||
fmt.Printf("Starting %d monitors:\n", len(config.Monitors))
|
||||
log.Printf("System: %s, API: %s\n", config.SystemName, config.APIUrl)
|
||||
log.Printf("Starting %d monitors:\n", len(config.Monitors))
|
||||
for _, mon := range config.Monitors {
|
||||
fmt.Printf(" %s: GET %s & Expect HTTP %d\n", mon.Name, mon.URL, mon.ExpectedStatusCode)
|
||||
log.Printf(" %s: GET %s & Expect HTTP %d\n", mon.Name, mon.URL, mon.ExpectedStatusCode)
|
||||
if mon.MetricID > 0 {
|
||||
fmt.Printf(" - Logs lag to metric id: %d\n", mon.MetricID)
|
||||
log.Printf(" - Logs lag to metric id: %d\n", mon.MetricID)
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
log.Println()
|
||||
|
||||
ticker := time.NewTicker(time.Second)
|
||||
for range ticker.C {
|
||||
|
||||
Reference in New Issue
Block a user