Output Control
Porch provides several ways to control the output and logging behavior of your workflows. This includes environment variables for logging, command-line flags for output formatting, and color control.
Log Levels
Porch uses structured logging with different log levels. Control the log level using the PORCH_LOG_LEVEL environment variable.
Available Log Levels
| Level | Description | When to Use |
|---|---|---|
DEBUG | Detailed debugging information | Development and troubleshooting |
INFO | General informational messages | Normal operation (default) |
WARN | Warning messages | Important but non-critical issues |
ERROR | Error messages | Error conditions only |
Setting Log Level
Example Output by Level
DEBUG level (most verbose):
INFO level (default):
ERROR level (least verbose):
Stdout and Stderr
By default, Porch captures stdout and stderr from all commands. You can control what appears in the results using command-line flags.
Command-Line Flags
Default Behavior
By default:
- Stdout: Not included in output (unless
--stdoutis specified) - Stderr: Included for failed commands and commands with skip exit codes
- Success details: Not included for successful commands (unless
--successis specified)
Example: Showing Stdout
Example: Hiding Stderr
Example: Showing Success Details
Color Output
Porch automatically detects terminal capabilities and displays colored output when supported.
Controlling Color
Color Indicators
Porch uses colors to indicate command status:
- Green (✓): Successful commands
- Red (✗): Failed commands
- Yellow (⚠): Commands with warnings or non-zero success codes
- Gray: Skipped commands
- Blue: Running commands (in TUI)
Disabling Color for CI/CD
Many CI/CD systems don’t support ANSI color codes. Disable color:
Saving Results
Save workflow results to a file for later review:
Results File Format
Results are saved as gob files containing:
- Command hierarchy
- Exit codes
- Execution duration
- Stdout and stderr output
- Environment variables
- Working directories
Output Formats
Tree View (Default)
Tree View with Details
You can add additional details to the output using the --show-details/--details flag.
Doing this will show information such as exit codes, the cwd, and the command type.
Redirecting Command Output
Within commands, use shell redirection to control output:
Practical Examples
Verbose Development Mode
Clean CI/CD Output
Detailed Results Review
Production Deployment
Best Practices
- Use PORCH_LOG_LEVEL=DEBUG for development: Get detailed information during development
- Use PORCH_LOG_LEVEL=ERROR for production: Reduce noise in production logs
- Save results in CI/CD: Keep audit trail with
--out results - Disable color in CI/CD: Use
NO_COLOR=1to avoid escape sequences - Use –stdout for debugging: See command output when troubleshooting
- Use –success for detailed analysis: Review timing and exit codes
- Redirect important messages to stderr: Makes them visible in default output
Environment Variables Summary
| Variable | Values | Default | Purpose |
|---|---|---|---|
PORCH_LOG_LEVEL | DEBUG, INFO, WARN, ERROR | INFO | Control logging verbosity |
NO_COLOR | 1 or any value | Not set | Disable color output |
FORCE_COLOR | 1 or any value | Not set | Force color output |
Command-Line Flags Summary
| Flag | Shorthand | Description |
|---|---|---|
--output-stdout | --stdout | Include stdout in results |
--no-output-stderr | --no-stderr | Exclude stderr from results |
--output-success-details | --success | Include details for successful commands |
--out <file> | Save results to file |
Related
- TUI - Interactive terminal user interface
- Flow Control - Understanding skip codes and errors
- Shell Command - Using redirection in commands