Skip to content

[Feature Idea] Debug Mode #35

@albertalef

Description

@albertalef

Problem: Hard to see what commands are actually being executed.

Solution: Add verbose debug output mode.

# Enable for single block
sh(debug: true) do
  mkdir("test")
  cd("test") do
    touch("file.txt")
  end
end
# Output:
# [DEBUG] Executing: mkdir test
# [DEBUG]   Duration: 3ms
# [DEBUG]   Exit code: 0
# [DEBUG] Changing directory to: test
# [DEBUG] Executing: touch file.txt
# [DEBUG]   Duration: 2ms
# [DEBUG]   Exit code: 0

# Enable globally
RubyShell.debug = true

# Custom logger
RubyShell.logger = Logger.new("rubyshell.log")

# Log levels
RubyShell.log_level = :info  # :debug, :info, :warn, :error

Implementation:

  • Add logging hooks in TerminalExecutor and Executor
  • Configurable logger (default to STDERR)
  • Include command, duration, exit code, and optionally stdout/stderr

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions