Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Running `lstk` will automatically handle configuration setup and start LocalStac
- **Start / stop / status** — manage LocalStack emulators with a single command
- **Interactive TUI** — a Bubble Tea-powered terminal UI when run in an interactive shell
- **Plain output** for CI/CD and scripting (auto-detected in non-interactive environments or forced with `--non-interactive`)
- **Log streaming** — tail emulator logs in real-time with `--follow`
- **Log streaming** — tail emulator logs in real-time with `--follow`; use `--verbose` to show all logs without filtering
- **Browser-based login** — authenticate via browser and store credentials securely in the system keyring
- **AWS CLI profile** — optionally configure a `localstack` profile in `~/.aws/` after start
- **Self-update** — check for and install the latest `lstk` release with `lstk update`
Expand Down Expand Up @@ -161,6 +161,9 @@ lstk status
# Stream emulator logs
lstk logs --follow

# Stream all emulator logs without filtering
lstk logs --follow --verbose

# Log in (opens browser for authentication)
lstk login

Expand Down
11 changes: 8 additions & 3 deletions cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/localstack/lstk/internal/env"
"github.com/localstack/lstk/internal/output"
"github.com/localstack/lstk/internal/runtime"
"github.com/localstack/lstk/internal/ui"
"github.com/localstack/lstk/internal/telemetry"
"github.com/localstack/lstk/internal/ui"
"github.com/spf13/cobra"
)

Expand All @@ -25,6 +25,10 @@ func newLogsCmd(cfg *env.Env, tel *telemetry.Client) *cobra.Command {
if err != nil {
return err
}
verbose, err := cmd.Flags().GetBool("verbose")
if err != nil {
return err
}
rt, err := runtime.NewDockerRuntime(cfg.DockerHost)
if err != nil {
return err
Expand All @@ -34,11 +38,12 @@ func newLogsCmd(cfg *env.Env, tel *telemetry.Client) *cobra.Command {
return fmt.Errorf("failed to get config: %w", err)
}
if isInteractiveMode(cfg) {
return ui.RunLogs(cmd.Context(), rt, appConfig.Containers, follow)
return ui.RunLogs(cmd.Context(), rt, appConfig.Containers, follow, verbose)
}
return container.Logs(cmd.Context(), rt, output.NewPlainSink(os.Stdout), appConfig.Containers, follow)
return container.Logs(cmd.Context(), rt, output.NewPlainSink(os.Stdout), appConfig.Containers, follow, verbose)
}),
}
cmd.Flags().BoolP("follow", "f", false, "Follow log output")
cmd.Flags().BoolP("verbose", "v", false, "Show all log output without filtering")
return cmd
}
4 changes: 2 additions & 2 deletions internal/container/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/localstack/lstk/internal/runtime"
)

func Logs(ctx context.Context, rt runtime.Runtime, sink output.Sink, containers []config.ContainerConfig, follow bool) error {
func Logs(ctx context.Context, rt runtime.Runtime, sink output.Sink, containers []config.ContainerConfig, follow bool, verbose bool) error {
if len(containers) == 0 {
return fmt.Errorf("no containers configured")
}
Expand All @@ -30,7 +30,7 @@ func Logs(ctx context.Context, rt runtime.Runtime, sink output.Sink, containers
scanner := bufio.NewScanner(pr)
for scanner.Scan() {
line := scanner.Text()
if shouldFilter(line) {
if !verbose && shouldFilter(line) {
continue
}
level, _ := parseLogLine(line)
Expand Down
4 changes: 2 additions & 2 deletions internal/ui/run_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/localstack/lstk/internal/runtime"
)

func RunLogs(parentCtx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, follow bool) error {
func RunLogs(parentCtx context.Context, rt runtime.Runtime, containers []config.ContainerConfig, follow bool, verbose bool) error {
ctx, cancel := context.WithCancel(parentCtx)
defer cancel()

Expand All @@ -21,7 +21,7 @@ func RunLogs(parentCtx context.Context, rt runtime.Runtime, containers []config.
runErrCh := make(chan error, 1)

go func() {
err := container.Logs(ctx, rt, output.NewTUISink(programSender{p: p}), containers, follow)
err := container.Logs(ctx, rt, output.NewTUISink(programSender{p: p}), containers, follow, verbose)
runErrCh <- err
if err != nil && !errors.Is(err, context.Canceled) {
p.Send(runErrMsg{err: err})
Expand Down
Loading