-
Notifications
You must be signed in to change notification settings - Fork 240
/
logs.go
38 lines (31 loc) · 940 Bytes
/
logs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package cmd
import (
"github.com/superfly/flyctl/cmdctx"
"github.com/superfly/flyctl/internal/client"
"github.com/superfly/flyctl/internal/monitor"
"github.com/superfly/flyctl/docstrings"
)
func newLogsCommand(client *client.Client) *Command {
logsStrings := docstrings.Get("logs")
cmd := BuildCommandKS(nil, runLogs, logsStrings, client, requireSession, requireAppName)
// TODO: Move flag descriptions into the docStrings
cmd.AddStringFlag(StringFlagOpts{
Name: "instance",
Shorthand: "i",
Description: "Filter by instance ID",
})
cmd.AddStringFlag(StringFlagOpts{
Name: "region",
Shorthand: "r",
Description: "Filter by region",
})
return cmd
}
func runLogs(ctx *cmdctx.CmdContext) error {
err := monitor.WatchLogs(ctx, ctx.Out, monitor.LogOptions{
AppName: ctx.AppName,
VMID: ctx.Config.GetString("instance"),
RegionCode: ctx.Config.GetString("region"),
})
return err
}