We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62542a1 commit 7198858Copy full SHA for 7198858
logpipe.go
@@ -19,6 +19,7 @@ package main
19
import (
20
"bufio"
21
"fmt"
22
+ "io"
23
"os"
24
25
flags "github.com/jessevdk/go-flags"
@@ -57,11 +58,9 @@ func main() {
57
58
logger := client.Logger(opts.LogName)
59
60
// Read from Stdin and log it to Stdout and Stackdriver
- s := bufio.NewScanner(os.Stdin)
61
+ s := bufio.NewScanner(io.TeeReader(os.Stdin, os.Stdout))
62
for s.Scan() {
- text := s.Text()
63
- fmt.Println(text)
64
- logger.Log(logging.Entry{Payload: text})
+ logger.Log(logging.Entry{Payload: s.Text()})
65
}
66
67
// Closes the client and flushes the buffer to the Stackdriver Logging
0 commit comments