summaryrefslogtreecommitdiff
path: root/stdin.go
diff options
context:
space:
mode:
Diffstat (limited to 'stdin.go')
-rw-r--r--stdin.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/stdin.go b/stdin.go
index dd89234..50976b7 100644
--- a/stdin.go
+++ b/stdin.go
@@ -22,12 +22,16 @@ func init() {
func readFromStdin() <-chan []byte {
out := make(chan []byte)
go func() {
- stlogger.Println("Now listening on stdin...")
+ if VERBOSE {
+ stlogger.Println("Now listening on stdin...")
+ }
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
out <- []byte(scanner.Text())
}
- stlogger.Println("Finished listening to stdin!")
+ if VERBOSE {
+ stlogger.Println("Finished listening to stdin!")
+ }
close(out)
}()
return out
@@ -40,7 +44,9 @@ func parseRawData(in <-chan []byte, cfg *Config) <-chan []RawData {
stlogger.Println("Could not parse interval: ", err)
}
timeBin := time.Now().Add(ival / -2) //Make sure we are inside the correct timeBin
- stlogger.Println("Now parsing data from stdin...")
+ if VERBOSE {
+ stlogger.Println("Now parsing data from stdin...")
+ }
go func() {
rDat := make([]RawData, 0)
for line := range in {
@@ -76,7 +82,9 @@ func parseRawData(in <-chan []byte, cfg *Config) <-chan []RawData {
if len(rDat) > 0 {
out <- rDat
}
- stlogger.Println("Finished parsing data from stdin...")
+ if VERBOSE {
+ stlogger.Println("Finished parsing data from stdin...")
+ }
close(out)
}()
return out