Download the PHP package smartdesk/debug-logger without Composer
On this page you can find all versions of the php package smartdesk/debug-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package debug-logger
SmartDesk DebugLogger
[EN] Human-readable debug logger for WordPress development (PHP 8.1+).
Generates structured multi-line entries with SmartDesk caller info, an optional hook status block (♻️/⏳), and a level prefix (emoji + label).
Output goes to a sink: error_log() by default, optionally a rotating file via setWriter().
The output of a debug entry in debug.log or in your personal storage location looks something like this:
[DE] Menschenlesbarer Debug‑Logger für WordPress‑Entwicklung (PHP 8.1+).
Erzeugt strukturierte, mehrzeilige Einträge mit SmartDesk‑Caller‑Info, optionalem Hook‑Status‑Block (♻️/⏳) und Level‑Präfix (Emoji + Label).
Ausgabe geht an eine Senke (sink): standardmäßig error_log(), optional rotierende Datei via setWriter().
Die Ausgabe eines Debug-Eintrages in debug.log oder an deinem persönlichen Speicherort, sieht dann etwa so aus:
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Configuration
- API Reference
- Usage Examples
- Plugin Integration
- Testing
- Notes
- License
Features
- 🎯 WordPress-optimized: Designed specifically for WordPress development
- 📊 Hook status tracking: Visual indicators for fired (♻️) and pending (⏳) hooks
- 🎨 Human-readable output: Structured, multi-line debug entries
- 📁 Flexible output: Error log or rotating file support
- ⏱️ Built-in timers: Performance monitoring capabilities
- 🎭 Log levels: 8 different levels with emoji indicators
- 🔧 Easy integration: Simple setup for plugins and themes
Requirements
- PHP 8.1 or higher
- WordPress (any recent version)
- WP_DEBUG enabled for active operation
Installation
Quick Start
Configuration
Basic Setup
Advanced Configuration
Output Configuration
Error Log Output (Default)
Rotating File Output
Custom Writer
Log Level Configuration
Request Tracking
API Reference
Static Methods
setWriter(WriterInterface $writer): void
Sets the output destination for log messages.
setMinLevel(string $level): void
Sets the minimum log level. Only messages at this level or higher will be output.
makeRotatingWriter(string $dir, string $filename, int $maxSize, int $maxFiles): FileHandler
Creates a rotating file handler.
Parameters:
$dir- Directory path for log files$filename- Base filename (e.g., 'app.log')$maxSize- Maximum file size in bytes before rotation$maxFiles- Number of backup files to keep
Logging Methods
log(mixed $data, string|array $hooks = '', string $title = '', string $level = LogLevel::DEBUG): void
Main logging method.
Shortcut Methods
Timer Methods
timerStart(string $name): void
Starts a named timer.
timerLap(string $name, string $title = ''): void
Records a lap time without stopping the timer.
timerStop(string $name, string $title = '', string $level = LogLevel::DEBUG): void
Stops the timer and logs the total time.
Hook Methods
hook(string|array $hooks, string $title = ''): void
Logs only hook status information without additional data.
Usage Examples
Setup Rotating file sink with Request marker
Log
Log just Hook-State
Available Hook Presets
The logger includes predefined hook sets for common WordPress scenarios:
Preset Details:
'load'- WordPress core loading sequence (muplugins_loaded, plugins_loaded, init, etc.)'register'- Plugin/theme registration hooks (plugins_loaded, init, admin_init, etc.)'admin'- Admin area hooks (admin_init, admin_menu, current_screen, etc.)'frontend'- Frontend hooks (wp, template_redirect, wp_enqueue_scripts, etc.)'enqueue'- Script/style enqueuing hooks'woo'- WooCommerce-specific hooks'rest'- REST API related hooks'request'- Request processing hooks (parse_request, wp, template_redirect, etc.)
Timer
Output:
Plugin Integration
WordPress
See the dedicated guide: WP-IMPLEMENTATION.md — step-by-step
- Composer & manual install
- Robust plugin bootstrap (autoloader fallback)
- Theme & multisite setup
- Hook/action tracking
- DB query logging
- Performance timers
- WP-CLI integration
- Security, and troubleshooting
Testing
Notes
Active only if WP_DEBUG === true.
Timestamps in UTC.
Single sink: default error_log(), or rotating file via setWriter().
License
GPL-3.0-or-later. See LICENSE.