Skip to content
This repository was archived by the owner on Apr 7, 2024. It is now read-only.

Commit f794c30

Browse files
James BednellJames Bednell
authored andcommitted
Added input.redirectstdout flag to echo lines to stdout
1 parent 7980722 commit f794c30

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

exporter.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ var (
4545

4646
inputType = flag.String("input.type", "", "What input module to use")
4747
listInputTypes = flag.Bool("input.print", false, "Print available input modules and exit")
48+
redirectStdout = flag.Bool("input.redirectstdout", false, "Redirects to stdout")
4849

4950
metricsListenAddr = flag.String("web.listen-address", ":9178", "Address on which to expose metrics")
5051
metricsPath = flag.String("web.metrics-path", "/metrics", "Path under which the metrics are available")
@@ -124,7 +125,7 @@ func main() {
124125
done = true
125126
break
126127
}
127-
log.Debugf("Got line %q", line)
128+
logLine(line)
128129
for _, m := range metrics {
129130
t := time.Now()
130131
m.MatchLine(line)
@@ -138,3 +139,11 @@ func main() {
138139
}
139140
}
140141
}
142+
143+
func logLine(line string) {
144+
if *redirectStdout == true {
145+
fmt.Println(line)
146+
} else {
147+
log.Debugf(line)
148+
}
149+
}

0 commit comments

Comments
 (0)