MCPcopy Create free account
hub / github.com/Scalingo/cli / Logs

Function Logs

apps/logs.go:18–47  ·  view source on GitHub ↗
(ctx context.Context, appName string, stream bool, n int, filter string)

Source from the content-addressed store, hash-verified

16}
17
18func Logs(ctx context.Context, appName string, stream bool, n int, filter string) error {
19 c, err := config.ScalingoClient(ctx)
20 if err != nil {
21 return errors.Wrapf(ctx, err, "fail to get Scalingo client")
22 }
23
24 err = checkFilter(ctx, c, appName, filter)
25 if err != nil {
26 return errors.Wrap(ctx, err, "check logs filter")
27 }
28
29 logsURLRes, err := c.LogsURL(ctx, appName)
30 if err != nil {
31 return errors.Wrapf(ctx, err, "fetch logs URL for app %s", appName)
32 }
33
34 err = logs.Dump(ctx, logsURLRes.LogsURL, n, filter)
35 if err != nil {
36 return errors.Wrap(ctx, err, "dump application logs")
37 }
38
39 if stream {
40 err := logs.Stream(ctx, logsURLRes.LogsURL, filter)
41 if err != nil {
42 return errors.Wrap(ctx, err, "stream application logs")
43 }
44 }
45
46 return nil
47}
48
49func checkFilter(ctx context.Context, c *scalingo.Client, appName string, filter string) error {
50 if filter == "" {

Callers 1

logs.goFile · 0.92

Calls 4

ScalingoClientFunction · 0.92
DumpFunction · 0.92
StreamFunction · 0.92
checkFilterFunction · 0.85

Tested by

no test coverage detected