內容簡介
<b>繁體中文總結:</b>
<ul>
<li>這個外掛程式可以捕捉大部分的JavaScript錯誤,將其記錄下來並在儀表板小工具中顯示。</li>
<li>具有以下特點:</li>
<ul>
<li>除外插件設置外,不涉及數據庫存儲,日誌會寫入“.log”文件中。</li>
<li>在儀表板小工具中顯示最新的JavaScript錯誤。</li>
<li>從儀表板小工具中刷新錯誤。</li>
<li>在單獨頁面上查看完整錯誤日誌。</li>
<li>如果用戶代理包含特定字符串,則忽略錯誤。</li>
<li>如果錯誤包含特定字符串,則忽略錯誤。</li>
<li>如果腳本URL中包含特定字符串,則忽略錯誤。</li>
<li>查看導致錯誤的頁面和腳本。</li>
</ul>
</ul>
<b>問題與答案:</b>
<ul>
<li>這個外掛程式的日誌如何進行維護?</li>
<ul>
<li>答:這個外掛程式每24小時清理一次日誌,僅保留最後100個條目。你可以通過使用“jserrlog_max_log_entries”來啟用更多或更少條目,通過返回整數:add_filter('jserrlog_max_log_entries',function(){return 200;})。</li>
</ul>
<li>為了防止來自無窮迴圈的錯誤,每頁載入時此外掛程式最多會記錄多少錯誤?</li>
<ul>
<li>答:為了防止來自無窮迴圈的錯誤,此外掛程式每頁載入時最多只會記錄10個錯誤。你可以通過使用“jserrlog_max_errors_per_page”來增加或減少每頁載入時記錄的錯誤數量,通過返回整數:add_filter('jserrlog_max_errors_per_page',function(){return 15;})。</li>
</ul>
<li>此外掛程式預設會在所有文章類型上添加其腳本嗎?</li>
<ul>
<li>答:是的,此外掛程式將在所有文章類型上添加其腳本。你可以通過使用“jserrlog_ignored_post_types”來忽略特定文章類型,通過返回一個文章類型的數組:add_filter('jserrlog_ignored_post_types',function(){return ['post','products','my_cpt'];})。</li>
</ul>
</ul>
外掛標籤
開發者團隊
原文外掛簡介
The plugin catches most JS errors, logs them, and displays them in a dashboard widget.
Here are some of its features:
Except for the plugin settings, there is no database storage involved. Log is written in a “.log” file.
Display latest JS errors in a dashboard widget.
Refresh errors from the dashboard widget.
See the full error log on a separate page.
Ignore errors if the user agent contains a specific string.
Ignore errors if the error contains a specific string.
Ignore errors if the script url contains a specific string.
See which page and which script triggered the errors.
Choose the maximum amount of errors to log per page load.
Exclude logging errors from specific post types.
Choose how ajax calls are made.
Developer hooks and filters
The plugin cleans the log every 24 hours, to only keep the last 100 entries.
You may use the “jserrlog_max_log_entries” WP filter to enable more or less entries, by returning an integer: add_filter('jserrlog_max_log_entries',function(){return 200;})
Alter error data:
You may use the “jserrlog_pre_insert_error” WP filter to modify the error data before it’s inserted into the log file: add_filter('jserrlog_pre_insert_error',function($error_data){return $error_data;})
Trigger integrations:
You may use the “jserrlog_after_log” WP hook to trigger an action (Slack notification, etc.) after an error was logged: add_action('jserrlog_after_log',function($error_data){//do something})
Backup old errors:
You may use the “jserrlog_before_log_maintenance” WP hook to trigger an action (archive errors, etc.) before old errors are deleted: add_action('jserrlog_before_log_maintenance',function($errors){//do something})
Multisite
The plugin works with multisite. There’s one error log per site.
