GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Update logs command · PastureStack/cli@cc19517

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cmd
    • logs.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cmd/logs.go‎

Copy file name to clipboardExpand all lines: cmd/logs.go
+20-5Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import (
1818
)
1919

2020
type logOptions struct {
21-
Follow bool `json:"follow"`
22-
Lines int `json:"lines"`
21+
Follow bool `json:"follow"`
22+
Lines int `json:"lines"`
23+
Timestamps bool `json:"timestamps"`
24+
Since string `json:"since"`
2325
}
2426

2527
var loggerFactory = logger.NewColorLoggerFactory()
@@ -196,8 +198,10 @@ func logsCommand(ctx *cli.Context) error {
196198
}
197199

198200
payload := logOptions{
199-
Follow: ctx.Bool("follow"),
200-
Lines: ctx.Int("tail"),
201+
Follow: ctx.Bool("follow"),
202+
Lines: ctx.Int("tail"),
203+
Timestamps: ctx.Bool("timestamps"),
204+
Since: ctx.String("since"),
201205
}
202206

203207
payloadJSON, err := json.Marshal(payload)
@@ -241,7 +245,18 @@ func doLog(wsURL string) error {
241245
if nil != err {
242246
return err
243247
}
244-
fmt.Println(string(buf))
248+
// The websocket frame has "0* " to start the log, drop that to match UI
249+
pieces := strings.SplitN(string(buf), " ", 2)
250+
var log string
251+
if len(pieces) == 2 {
252+
log = pieces[1]
253+
} else {
254+
log = pieces[0]
255+
}
256+
if !strings.HasSuffix(log, "\n") {
257+
log = log + "\n"
258+
}
259+
fmt.Print(log)
245260
}
246261
}
247262

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.