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
Problem: Hard to see what commands are actually being executed.
Solution: Add verbose debug output mode.
Implementation:
TerminalExecutorandExecutor