Logs displays the addon logs. app may be an app UUID or name. addon may be a addon UUID or an addon type (e.g. MongoDB).
(ctx context.Context, app, addonUUID string, opts LogsOpts)
| 17 | // app may be an app UUID or name. |
| 18 | // addon may be a addon UUID or an addon type (e.g. MongoDB). |
| 19 | func Logs(ctx context.Context, app, addonUUID string, opts LogsOpts) error { |
| 20 | c, err := config.ScalingoClient(ctx) |
| 21 | if err != nil { |
| 22 | return errors.Wrapf(ctx, err, "fail to get Scalingo client") |
| 23 | } |
| 24 | |
| 25 | url, err := c.AddonLogsURL(ctx, app, addonUUID) |
| 26 | if err != nil { |
| 27 | return errors.Wrapf(ctx, err, "fail to get log URL") |
| 28 | } |
| 29 | |
| 30 | err = logs.Dump(ctx, url, opts.Count, "") |
| 31 | if err != nil { |
| 32 | return errors.Wrapf(ctx, err, "fail to dump logs") |
| 33 | } |
| 34 | |
| 35 | if opts.Follow { |
| 36 | err := logs.Stream(ctx, url, "") |
| 37 | if err != nil { |
| 38 | return errors.Wrapf(ctx, err, "fail to stream logs") |
| 39 | } |
| 40 | } |
| 41 | return nil |
| 42 | } |
no test coverage detected