Remove PHP Error Logs
A VS Code extension that removes all error_log() function calls from PHP files in your workspace.
Features
- Fast Performance: Optimized line-by-line processing prevents hanging on large files
- File Size Protection: Automatically skips files larger than 5MB to prevent performance issues
- Cancellable Operations: Users can cancel long-running operations
- Smart Detection: Removes various forms of error_log calls (single-line, multi-line, inline)
- Progress Tracking: Real-time progress with file count and current file name
- Safety First: Asks for confirmation before making changes
- Vendor Exclusion: Automatically excludes vendor directories
- Clean Output: Removes excessive blank lines left after deletion
- Error Handling: Continues processing other files if one file fails
Usage
- Open a workspace containing PHP files
- Open Command Palette (
Ctrl+Shift+P or Cmd+Shift+P )
- Run command:
PHP: Remove PHP Error Logs
- Confirm the action when prompted
- The extension will scan all PHP files and remove error_log calls
You can also right-click on a folder in the Explorer and select "Remove PHP Error Logs" from the context menu.
What it removes
The extension removes various forms of error_log calls:
// Simple error_log
error_log('Debug message');
// Error_log with multiple parameters
error_log('Error occurred', 3, '/var/log/myapp.log');
// Multi-line error_log
error_log(
'Complex message: ' .
$variable .
' at line ' . __LINE__
);
// Inline error_log (as part of other statements)
$result = doSomething() or error_log('Failed');
Safety
- The extension will ask for confirmation before making changes
- It excludes
vendor directories by default
- Shows a summary of changes made
Requirements
- VS Code 1.103.0 or higher
- A workspace with PHP files
Known Issues
None currently reported. Please report issues on the GitHub repository.
Release Notes
1.0.0
Initial release of Remove PHP Error Logs extension.
- Smart detection of various error_log call patterns
- Progress tracking with user feedback
- Safety confirmation before making changes
- Automatic exclusion of vendor directories
- Clean output with blank line removal
License
MIT
| |