Skip to content

Commit 4ab5f60

Browse files
committed
Reduce logging from log streaming command
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent a8b61f2 commit 4ab5f60

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

pkg/logs/requestor.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ func (r *requester) Query(ctx context.Context, req logs.Request) (<-chan logs.Me
5858

5959
// buildCmd reeturns the equivalent of
6060
//
61-
// journalctl -t <namespace>:<name> \
62-
// --output=json \
63-
// --since=<timestamp> \
64-
// <--follow> \
61+
// journalctl -t <namespace>:<name> \
62+
// --output=json \
63+
// --since=<timestamp> \
64+
// <--follow> \
6565
func buildCmd(ctx context.Context, req logs.Request) *exec.Cmd {
6666
// // set the cursor position based on req, default to 5m
6767
since := time.Now().Add(-5 * time.Minute)
@@ -105,12 +105,12 @@ func streamLogs(ctx context.Context, cmd *exec.Cmd, out io.ReadCloser, msgs chan
105105

106106
// will ensure `out` is closed and all related resources cleaned up
107107
go func() {
108-
err := cmd.Wait()
109-
log.Println("wait result", err)
108+
if err := cmd.Wait(); err != nil {
109+
log.Printf("journalctl exited with error: %s", err)
110+
}
110111
}()
111112

112113
defer func() {
113-
log.Println("closing journal stream")
114114
close(msgs)
115115
}()
116116

@@ -176,7 +176,6 @@ func parseEntry(entry map[string]string) (logs.Message, error) {
176176
}
177177

178178
func logErrOut(out io.ReadCloser) {
179-
defer log.Println("stderr closed")
180179
defer out.Close()
181180

182181
io.Copy(log.Writer(), out)

0 commit comments

Comments
 (0)