From 610552be883667d34c8486cec7c9916eca08a4bc Mon Sep 17 00:00:00 2001 From: Joseph Lawson Date: Wed, 23 Apr 2014 11:45:39 -0400 Subject: [PATCH] fixing stat errors --- gor_stat.go | 10 +++++----- output_http.go | 2 +- settings.go | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gor_stat.go b/gor_stat.go index 5291090..1324740 100644 --- a/gor_stat.go +++ b/gor_stat.go @@ -1,9 +1,9 @@ package main import ( - "strconv" "time" "log" + "strconv" ) const ( @@ -19,8 +19,8 @@ type GorStat struct { currentTime int64 } -func NewGorStat(statName string) (s *GorStat) { - s = new(GorStat) +func NewGorStat(statName string) GorStat { + s := new(GorStat) s.statName = statName s.latest = 0 s.min = 0 @@ -29,7 +29,7 @@ func NewGorStat(statName string) (s *GorStat) { if Settings.stats { go s.reportStats() } - return + return s } func (s *GorStat) Write(latest int) { @@ -45,7 +45,7 @@ func (s *GorStat) Write(latest int) { } func (s *GorStat) String() string { - return s.statName + ":" + Itoa(s.latest) + "," + Itoa(s.min) + "," + Itoa(s.max) + return s.statName + ":" + strconv.Itoa(s.latest) + "," + strconv.Itoa(s.min) + "," + strconv.Itoa(s.max) } func (s *GorStat) reportStats() { diff --git a/output_http.go b/output_http.go index 7e81322..b05af82 100644 --- a/output_http.go +++ b/output_http.go @@ -47,7 +47,7 @@ type HTTPOutput struct { elasticSearch *es.ESPlugin - bufStats GorStat + bufStats *GorStat } func NewHTTPOutput(options string, headers HTTPHeaders, methods HTTPMethods, elasticSearchAddr string) io.Writer { diff --git a/settings.go b/settings.go index 83051ca..ea888f0 100644 --- a/settings.go +++ b/settings.go @@ -13,6 +13,7 @@ const ( type AppSettings struct { verbose bool + stats bool splitOutput bool