Linux 软件免费装
Banner图

RP Debug Log Viewer

开发者 rahuliprajapati
更新时间 2026年7月18日 15:39
PHP版本: 7.4 及以上
WordPress版本: 7.0
版权: GPLv2 or later
版权网址: 版权信息

标签

debug developer tools error log code snippets log viewer

下载

1.1.0

详情介绍:

Stop drowning in one messy debug.log file. RP Debug Log Viewer turns chaotic WordPress debugging into a fast, focused workflow — right inside your admin dashboard. Create custom log files for any feature — payments, APIs, cron jobs, custom code — and capture rich context with every entry: error codes, file names, line numbers, and more. A beautiful, color-coded log viewer lets you scan, search, and filter entries instantly, so you spot exactly what broke and where — in seconds, not hours. Toggle, download, or clear any log in one click. And with the built-in PHP Snippets manager, you can drop in hooks, filters, and temporary debugging code straight from the admin panel — no FTP, no functions.php edits, no extra snippet plugin. Whether you're a developer hunting a stubborn bug, a researcher analyzing patterns, or a site owner who just wants answers, RP Debug Log Viewer makes debugging effortless, organized, and genuinely enjoyable. PHP Snippets — Run Debug Code Without Another Plugin The Snippets page lets administrators create and manage small PHP snippets for WordPress debugging and development: Snippets are PHP-only by design and run on every page load (during plugins_loaded) while active — ideal for hooks, filters, actions, debugging functions, temporary custom code, and testing new features. Why Use RP Debug Log Viewer? Who Is This For? Key Features Quick Start (3 Steps) Step 1. Install and activate the plugin. Step 2. Add a log call anywhere in your PHP code: rp_dlv_info( 'my-plugin', 'User registered successfully', [ 'user_id' => 42 ] ); Step 3. Open RP Debug Log Viewer in your admin sidebar and click the tab for your log file. That's it. Available Functions Five global helper functions are available as soon as the plugin is active: rp_dlv_info( $log_name, $message, $context = [] ) rp_dlv_warning( $log_name, $message, $context = [] ) rp_dlv_error( $log_name, $message, $context = [] ) rp_dlv_debug( $log_name, $message, $context = [] ) rp_dlv_log( $log_name, $message, $level = 'info', $context = [] ) Real-World Examples Log a user login: add_action( 'wp_login', function( $login, $user ) { rp_dlv_info( 'auth', 'Login: ' . $login, [ 'id' => $user->ID ] ); }, 10, 2 ); Log a remote API call: $response = wp_remote_get( $url ); if ( is_wp_error( $response ) ) { rp_dlv_error( 'api', $response->get_error_message(), [ 'url' => $url ] ); } else { rp_dlv_info( 'api', 'Success', [ 'status' => wp_remote_retrieve_response_code( $response ) ] ); } Log WooCommerce payment events: add_action( 'woocommerce_payment_complete', function( $order_id ) { rp_dlv_info( 'woocommerce', 'Payment complete', [ 'order_id' => $order_id ] ); } ); Dump a full PHP array for inspection: $cart = WC()->cart->get_cart(); rp_dlv_debug( 'woocommerce', $cart ); Measure execution time: $start = microtime( true ); $result = heavy_import(); rp_dlv_info( 'import', 'Finished', [ 'elapsed_ms' => round( ( microtime(true) - $start ) * 1000, 2 ) ] ); How Log Files Are Stored Custom log files are stored in wp-content/uploads/rp-debug-log-viewer/. The directory is automatically protected: The standard WordPress debug.log (in wp-content/) is also viewable, searchable, and downloadable as a built-in tab — but it is never written to, cleared, or deleted by this plugin, since that file lives outside the plugin's own directory and is owned by WordPress core. Security

安装:

  1. Upload the rp-debug-log-viewer folder to the /wp-content/plugins/ directory, or install directly from the WordPress plugin repository via Plugins -> Add New and search for "RP Debug Log Viewer".
  2. Activate the plugin through the Plugins screen in WordPress.
  3. Navigate to RP Debug Log Viewer in the admin sidebar to open the Log Viewer.
  4. (Optional) Visit RP Debug Log Viewer -> Generate Sample Logs to populate demo log files and explore the viewer immediately.
  5. Start logging from your theme or plugin code using rp_dlv_info(), rp_dlv_warning(), rp_dlv_error(), or rp_dlv_debug().
  6. (Optional) Open RP Debug Log Viewer -> Snippets to add PHP debug snippets — or one-click add a Ready-Made Debug Snippet such as the rp_trace() variable inspector.

屏幕截图:

  • **Array / Object Dump** — Large PHP arrays and objects displayed as an expandable, syntax-highlighted JSON tree with a top-level key summary.
  • **Configuration** — Color pickers, font size, panel height/width controls, live preview, and drag-and-drop tab management with active/inactive toggles.

升级注意事项:

1.1.0 Adds the new Snippets feature: create, validate, and run PHP debug snippets from the admin panel — with syntax checking, crash protection, and ready-made samples. The database updates automatically; no manual steps required. 1.0.0 Initial release. No upgrade steps required.

常见问题:

Do I need to create the log file manually?

No. Calling any rp_dlv_*() function with a new log name automatically creates the file, registers it in the database, and adds it as a tab in the viewer. You can also create log files manually from the Log Viewer page using the "Create Custom Log File" form.

Where are log files stored?

In wp-content/uploads/rp-debug-log-viewer/. Each file is named <log-name>.log. The directory is protected from direct browser access with an .htaccess file and an index.php guard.

Is the WordPress debug.log supported?

Yes. The debug log is pre-registered and appears as the first tab in the viewer. It reads from the standard wp-content/debug.log file, and you can view, search, and download it like any other log. It cannot be cleared or deleted through the plugin, since wp-content/debug.log is owned by WordPress core and lives outside the plugin's own storage directory — this plugin never writes to it. To clear it, disable and re-enable WP_DEBUG_LOG in wp-config.php, or clear it manually via your host's file manager or SSH.

Can I disable logging for a specific log file?

Yes. Go to RP Debug Log Viewer -> Configuration -> Tab Management and toggle the log to Inactive. All rp_dlv_*() calls targeting that log will be silently skipped until it is re-activated. The log file itself is preserved — only new writes are paused.

Does this plugin slow down my site?

No. RP Debug Log Viewer is designed for zero frontend impact:

  • CSS and JavaScript are loaded only on the plugin's own admin pages — never on the frontend or on unrelated admin screens.
  • Log writes use file_put_contents() with FILE_APPEND, which is a single fast I/O operation.
  • No external API calls, no remote assets, and no background processes.

Is it safe to use in production?

Yes — with care. Toggle verbose debug logs to Inactive in Configuration so rp_dlv_debug() calls are skipped without touching your code. Keep info and error level logs active for ongoing monitoring. Avoid logging passwords, credit card numbers, or other sensitive personal data.

Can I log from inside a Composer package or mu-plugin?

Yes, as long as RP Debug Log Viewer is loaded before your code runs. Hooking into plugins_loaded at priority 10 or later is the safest approach for plugins. For mu-plugins, the logging functions are available after all regular plugins have loaded.

What are Snippets and when should I use them?

Snippets are small pieces of PHP code you write and manage from RP Debug Log Viewer -> Snippets — no FTP, no functions.php edits. Use them for hooks, filters, actions, debugging helpers, temporary custom code, or testing a new feature before it goes into your theme or plugin. Only snippets marked Active are executed; everything else just sits safely in the database. Snippets run on every page load during plugins_loaded, so anything you'd normally put in functions.php works the same way.

Is it safe to run PHP snippets? What if I save broken code?

You can't save broken code. Before a snippet is saved or activated, its code is run through PHP's own parser (without being executed). If there is a syntax error, the save is rejected and you see the exact problem and line number. If an already-active snippet fails at runtime (for example, it calls a function that doesn't exist), the error is caught, the snippet is automatically deactivated so it cannot crash subsequent requests, and an admin notice shows you what went wrong and where. As an emergency brake, adding define( 'RP_DLV_SNIPPETS_SAFE_MODE', true ); to wp-config.php disables all snippet execution instantly while keeping your snippets stored. Snippet management requires the manage_options capability (administrators only), and every action is nonce-protected.

Can snippets contain CSS, JavaScript, or HTML?

The Snippets feature is intentionally PHP-only and focused on WordPress debugging and development. If you need to output CSS or JavaScript, you can still do it the WordPress way from a PHP snippet — for example, by hooking wp_enqueue_scripts or wp_head.

Can I use this plugin alongside other debugging plugins?

Yes. RP Debug Log Viewer does not modify WordPress constants like WP_DEBUG or WP_DEBUG_LOG. It operates independently using its own log files and does not conflict with Query Monitor, Debug Bar, or any other debugging tool.

What happens when I delete the plugin?

All plugin data is cleaned up automatically: the custom database table is dropped, plugin options are removed, and all log files in wp-content/uploads/rp-debug-log-viewer/ are deleted. No orphaned data is left behind.

What PHP version is required?

PHP 7.4 or higher. PHP 8.0, 8.1, 8.2, 8.3, and 8.4 are fully supported.

Is this plugin translation-ready?

Yes. All UI strings use WordPress internationalization functions with the rp-debug-log-viewer text domain. A .pot file can be generated with WP-CLI: wp i18n make-pot . languages/rp-debug-log-viewer.pot.

更新日志:

1.1.0 1.0.0