[WordPress] 外掛分享: JS Error Logger

首頁 › 外掛目錄 › JS Error Logger
WordPress 外掛 JS Error Logger 的封面圖片
10+
安裝啟用
★★★★★
5/5 分(1 則評價)
13 天前
最後更新
—
問題解決
WordPress 5.0+ PHP 7.4+ v1.5 上架:2024-11-23

內容簡介

JS Error Logger 外掛能夠捕捉大部分的 JavaScript 錯誤,並將其記錄在控制台的小工具中,方便使用者檢視與管理錯誤日誌,提升網站的穩定性與效能。

【主要功能】
• 捕捉並記錄 JavaScript 錯誤
• 在控制台小工具中顯示最新錯誤
• 提供獨立頁面查看完整錯誤日誌
• 設定最大記錄錯誤數量
• 支援多站點環境

外掛標籤

開發者團隊

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

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

原文外掛簡介

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})
Request hardening:
You may use the “jserrlog_enforce_same_host_origin” WP filter to require same-host Origin/Referer checks for logging requests (default true): add_filter('jserrlog_enforce_same_host_origin',function(){return true;})
You may use the “jserrlog_rate_limit_requests” and “jserrlog_rate_limit_window” WP filters to control request throttling (defaults: 60 requests per 60 seconds): add_filter('jserrlog_rate_limit_requests',function(){return 120;}); add_filter('jserrlog_rate_limit_window',function(){return 60;});
You may use the “jserrlog_max_payload_bytes”, “jserrlog_max_batch_errors” and “jserrlog_max_error_field_length” WP filters to limit incoming payload sizes (defaults: 16384 bytes, 20 errors per batch, 512 chars per field): add_filter('jserrlog_max_payload_bytes',function(){return 32768;});
You may use the “jserrlog_duplicate_window” WP filter to suppress duplicate errors for a short period (default: 60 seconds): add_filter('jserrlog_duplicate_window',function(){return 30;});
Multisite
The plugin works with multisite. There’s one error log per site.

延伸相關外掛

文章
Filter
Mastodon