This plugin has a number of hooks that you can use, as developer or as a user, to customize the user experience or to give access to extended functionalities.
It is possible to add custom actions for each event displayed in the WordPress events viewers. It can be done in the events list view or right in the single event view (the "boxed" one).
For the list view, you can use the decalog_events_list_actions_for_event
, decalog_events_list_actions_for_source
, decalog_events_list_actions_for_time
, decalog_events_list_actions_for_site
, decalog_events_list_actions_for_user
and decalog_events_list_actions_for_ip
filters to add (for each of the corresponding columns) a icon associated with an action (an url).
Note "site" column is only displayed when in WordPress Multisite.
The format of the filtered value is an array of array(s). Each of the deepest array MUST contain 3 fields:
url
: the full url of the action to perfom. This url is opened in a new tab of the user's browser.hint
: the text displayed while hovering the icon.icon
: the "index" of the icon. Since DecaLog embeds the Feather icon library, you can choose any index of this library.
To add an "eye" icon near the IP (in list view) to perform a quick lookup of each IP with infobyip.com service:
add_filter(
'decalog_events_list_actions_for_ip',
function( $actions, $item ) {
$actions[] = [
'url' => 'https://www.infobyip.com/ip-' . $item['remote_ip'] . '.html',
'hint' => 'Get information about this IP',
'icon' => 'eye',
];
return $actions;
},
10,
2
);
For the single event view, you can use the decalog_event_view_actions_for_event
, decalog_event_view_actions_for_content
, decalog_event_view_actions_for_php
, decalog_event_view_actions_for_device
, decalog_event_view_actions_for_wp
, decalog_event_view_actions_for_http
, decalog_event_view_actions_for_wpbacktrace
and decalog_event_view_actions_for_phpbacktrace
filters to add (for each of the corresponding box) a text associated with an action (an url).
The format of the filtered value is an array of array(s). Each of the deepest array MUST contain 2 fields:
url
: the full url of the action to perfom. This url is opened in a new tab of the user's browser.text
: the text of the link anchor.
To add a "ban" action text in the "HTTP request" box:
add_filter(
'decalog_event_view_actions_for_http',
function( $actions, $item ) {
$actions[] = [
'url' => '/wp-admin/admin.php?page=ban-ip&ip=' . $item['remote_ip'],
'text' => 'Permanently ban ' . $item['remote_ip'],
];
return $actions;
},
10,
2
);
Each item passed to the filter as second parameter is an array containing details about the current event. The fields are as follow:
logger_id
string: the unique logger id;id
integer: the unique event id (for this specific logger id);timestamp
string: the date of the event, respecting the formatY-m-d H:i:s
;level
string: the level in {'emergency'
,'alert'
,'critical'
,'error'
,'warning'
,'notice'
,'info'
,'debug'
,'unknown'
};channel
string: the channel in {'cli'
,'cron'
,'ajax'
,'xmlrpc'
,'api'
,'feed'
,'wback'
,'wfront'
,'unknown'
};class
string: the class of the source in {'core'
,'plugin'
,'theme'
,'db'
,'php'
};component
string: the name of the source;version
string: the version of the source;code
int: the error code;message
string: the message associated to the event;site_id
integer: the unique site id where the event was triggered;site_name
string: the name of the site where the event was triggered;user_id
integer: the unique user id for whom the event was triggered - may be pseudonymized;user_name
string: the name of the user for whom the event was triggered - may be pseudonymized;user_session
string: the user's session hash;remote_ip
string: the remote IP doing the request - may be obfuscated.country_code
string: the country code (iso3166/alpha2) associated with the remote IP if IP Locator is installed, otherwise an empty string;url
string: the requested local url;verb
string: the verb of the inbound request in {'get'
,'head'
,'post'
,'put'
,'delete'
,'connect'
,'options'
,'trace'
,'patch'
,'unknown'
};server
string: the target server of the inbound request;referrer
string: the request referrer, if any;user_agent
string: the full user agent string of the client doing the inbound request;file
string: the file where the event was triggered;line
int: the line where the event was triggered;classname
string: the class name where the event was triggered;function
string: the function where the event was triggered;trace
string: the serialized full callstack triggering the event.
It is possible to add custom actions for each trace displayed in the WordPress traces viewers. It works exactly the same way as for the events.
For the list view, you can use the decalog_traces_list_actions_for_trace
, decalog_traces_list_actions_for_duration
, decalog_traces_list_actions_for_time
, decalog_traces_list_actions_for_site
and decalog_traces_list_actions_for_user
filters to add (for each of the corresponding columns) a icon associated with an action (an url).
For the single trace view, you can use the decalog_trace_view_actions_for_trace
and decalog_trace_view_actions_for_wp
filters to add (for each of the corresponding box) a text associated with an action (an url).
Each item passed to the filter as second parameter is an array containing details about the current trace. The fields are as follow:
logger_id
string: the unique logger id;id
integer: the unique trace id (for this specific logger id);trace_id
string: the main TraceID;timestamp
string: the date of the trace, following the formatY-m-d H:i:s
;channel
string: the channel in {'cli'
,'cron'
,'ajax'
,'xmlrpc'
,'api'
,'feed'
,'wback'
,'wfront'
,'unknown'
};duration
integer: the full duration (in ms.) of the trace;scount
integer: the number of spans in the trace;site_id
integer: the unique site id where the trace was recorded;site_name
string: the name of the site where the trace was recorded;user_id
integer: the unique user id for whom the trace was recorded - may be pseudonymized;user_name
string: the name of the user for whom the trace was recorded - may be pseudonymized;user_session
string: the user's session hash;spans
string: the serialized full spans array.
PHP error levels are supernumemary compared to the logger levels. The mapping translating one from the other can be customized with the decalog_error_level_map
filter.
Log the E_DEPRECATED
and E_USER_DEPRECATED
errors as DEBUG
level.
use \Decalog\Logger;
add_filter('decalog_error_level_map', function($levels) {
$levels[E_DEPRECATED] = Logger::DEBUG;
$levels[E_USER_DEPRECATED] = Logger::DEBUG;
return $levels;
});
You can use the poo_hide_main_menu
filter to completely hide the main PerfOps One menu or use the poo_hide_analytics_menu
, poo_hide_consoles_menu
, poo_hide_insights_menu
, poo_hide_tools_menu
, poo_hide_records_menu
and poo_hide_settings_menu
filters to selectively hide submenus.
Hide the main menu:
add_filter( 'poo_hide_main_menu', '__return_true' );
You can use the poo_hide_adminbar
filter to completely hide this plugin's item(s) from the admin bar.
Remove this plugin's item(s) from the admin bar:
add_filter( 'poo_hide_adminbar', '__return_true' );
By default, advanced settings and controls are hidden to avoid cluttering admin screens. Nevertheless, if this plugin have such settings and controls, you can force them to display with perfopsone_show_advanced
filter.
Display advanced settings and controls in admin screens:
add_filter( 'perfopsone_show_advanced', '__return_true' );