[WordPress] 外掛分享: Debugger

首頁外掛目錄 › Debugger
WordPress 外掛 Debugger 的封面圖片
10+
安裝啟用
★★★★
4.5/5 分(2 則評價)
4700 天前
最後更新
問題解決
WordPress 3.0+ v1.4 上架:2013-02-14

內容簡介

您可以使用此外掛手動記錄數據或捕獲 WordPress 行動的日誌。您可以捕獲負載時間、記憶體、backrace、數據轉儲、URL 和服務器 IP。

這是為使用 wp-config.php 和日誌 OR 使用管理員和 debugbar 插件(https://wordpress.org/extend/plugins/debug-bar/)設計的。以下大多數文檔同樣適用於設置面板或 wp-config.php 變量。兩者都可以正常工作。唯一的例外是僅支持作為 wp-config 變量的 DEBUG_LOG 配置。

首先,您可以使用以下函數手動記錄事物:

do_action( 'log', $message, $group, $data );

$group 允許您基於日誌消息的組選擇性地輸出日誌。$message 是您想在日誌中看到的字符串。$data 是一個可以在日誌中顯示的數據的可選參數(對象、數組或任何其他類型的數據)。

要將消息呈現為日誌,您必須按以下方式配置 wp-config.php:

僅對這些組運行 debug。使用 ‘ALL’ 來調試所有內容。該組 ‘ACTIONS’ 保留用於 WordPress 行動。

define( 'DEBUG_GROUPS', 'ACTIONS,default,myspecialgroup' );

每個日誌消息顯示這些輸出。

define( 'DEBUG_PARAMS', 'time,timedelta,memory,memorydelta,data,backtrace,url,server' );

您希望記錄的 WordPress 行動。

define( 'DEBUG_ACTIONS', 'wp_head,switch_theme,wp_footer' );

按 URL 进行可選限制(對 MU 安装很有用)。

define( 'DEBUG_URLS', 'myurl.com' );

需要以毫秒為單位的最小時間才能將日誌項目註冊為緩慢。默認值為 0,表示沒有最小值。

define( 'DEBUG_MIN_TIME', 500 );

需要以 kb 為單位的最小記憶體才能註冊日誌項目作為重載。默認值為 0,表示沒有最小值。

define( 'DEBUG_MIN_MEM', 1024 );

日誌文件的路徑,或設置為 TRUE 以使用 php 錯誤日誌。默認值為 FALSE,表示不記錄。

define( 'DEBUG_LOG', '/path/to/writable/log/file' );

或者

define( 'DEBUG_LOG', TRUE );

待辦事項

添加用於隨機在生產安裝上運行的樣本率變量
每個站點的管理面板
全局管理面板
WordPress 錯誤記錄
Mysql 查詢日誌
WP_Error 集成
警報,例如如果它花費的記憶體超過此程度,則記錄它...

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.4) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Debugger」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

You can use this plugin to manually log data or to capture logging on WordPress actions. You can capture load time, memory, backrace, data dumps, urls, and server IPs.
This is designed to either be managed using wp-config.php and logging OR using the admin and debugbar plugin ( https://wordpress.org/extend/plugins/debug-bar/ ). Most of the following documentation applies equally to the settings panel or the wp-config.php vars. Either one works fine. The only exception is the DEBUG_LOG configuration which is only supported as a wp-config var.
Firstly, you can manually log things using the following function:
do_action( 'log', $message, $group, $data );

The $group allows you to selectively output logging based on groups of log messages. The $message is the string you want to see in the log. $data is an optional parameter for the data that you want to display in the log (objects, arrays, or any other sort of data really).
To render messages to the log, you must configure wp-config.php as follows:
Run debug on only these groups. Use ‘ALL’ to debug everything. The group ‘ACTIONS’ is reserved for WordPress actions.
define( 'DEBUG_GROUPS', 'ACTIONS,default,myspecialgroup' );

Display these outputs in the log for each log message.
define( 'DEBUG_PARAMS', 'time,timedelta,memory,memorydelta,data,backtrace,url,server' );

WordPress actions that you wish to log.
define( 'DEBUG_ACTIONS', 'wp_head,switch_theme,wp_footer' );

Optional restriction by URL (useful on MU installs).
define( 'DEBUG_URLS', 'myurl.com' );

Minimum time in milliseconds required to register a log entry as being slow. Default 0 for no minumum.
define( 'DEBUG_MIN_TIME', 500 );

Minimum memory in killobytes required to register a log entry as being heavy. Default 0 for no minumum.
define( 'DEBUG_MIN_MEM', 1024 );

Path to log file or set to TRUE to use php error log. Default FALSE for no logging.
define( 'DEBUG_LOG', '/path/to/writable/log/file' );

or
define( 'DEBUG_LOG', TRUE );

Todo

Add variable for sample rate so that this could run randomly on production installs
Admin panel per site
Admin panel globally
WordPress error logging
Mysql query logging
WP_Error integration
Alerts ex: if this takes more than this much memory then log it…

延伸相關外掛

文章
Filter
Apply Filters
Mastodon