Skip to content

Commit 920eef7

Browse files
committed
[cmd/logs] Pull source from the log record
1 parent 86a8b27 commit 920eef7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/logs.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ type accessLog struct {
2323

2424
type logRecord struct {
2525
ID int `json:"id"`
26-
Message string `json:"message"`
2726
Timestamp time.Time `json:"timestamp"`
27+
Source string `json:"source"`
28+
Message string `json:"message"`
2829
}
2930

3031
type logResponse struct {
@@ -71,7 +72,7 @@ func printLogsOneShot(c *rest.APIClient, params url.Values) error {
7172
if err := dec.Decode(&lr); err != nil {
7273
return err
7374
}
74-
pretty.PrintLn(lr.Timestamp, "accesslog", lr.Message)
75+
pretty.PrintLn(lr.Timestamp, lr.Source, lr.Message)
7576
}
7677

7778
t, err = dec.Token() // ] delimiter.
@@ -107,7 +108,7 @@ func printLogsFollow(c *rest.APIClient, params url.Values) error {
107108
if lr.Result == nil {
108109
continue
109110
}
110-
pretty.PrintLn(lr.Result.Timestamp, "accesslog", lr.Result.Message)
111+
pretty.PrintLn(lr.Result.Timestamp, lr.Result.Source, lr.Result.Message)
111112
}
112113

113114
return nil

0 commit comments

Comments
 (0)