$enabled
$enabled :
Log events based on plugin settings
__construct(object $wpdb, string $version, string $slug = '', string $option_prefix = '')
Constructor which sets content type and pruning for logs
| object | $wpdb | An instance of the wpdb class. |
| string | $version | The version of this plugin. |
| string | $slug | The plugin slug |
| string | $option_prefix | The plugin's option prefix |
set_log_visibility( $log_args)
| $log_args |
add_prune_interval(array $schedules) : array
Add interval to wp schedules based on admin settings
| array | $schedules | An array of scheduled cron items. |
$frequency
get_schedule_frequency(string $unit, \number $number) : array
Convert the schedule frequency from the admin settings into an array interval must be in seconds for the class to use it
| string | $unit | A unit of time. |
| \number | $number | The number of those units. |
set_log_types(array $terms) : array
Set terms for Salesforce logs
| array | $terms | An array of string log types in the WP_Logging class. |
$terms
set_prune_option(string $should_we_prune) : string
Should logs be pruned at all?
| string | $should_we_prune | Whether to prune old log items. |
$should_we_prune Whether to prune old log items.
set_prune_age(string $how_old) : string
Set how often to prune the Salesforce logs
| string | $how_old | How old the oldest non-pruned log items should be allowed to be. |
$how_old
set_prune_args(array $args) : array
Set arguments for only getting the Salesforce logs
| array | $args | Argument array for get_posts determining what posts are eligible for pruning. |
$args
setup(string|array $title_or_params, string $message = '', string $trigger, integer $parent, string $status = '') : void
Setup new log entry
Check and see if we should log anything, and if so, send it to add()
| string|array | $title_or_params | A log post title, or the full array of parameters |
| string | $message | The log message. |
| string | $trigger | The type of log triggered. Usually one of: debug, notice, warning, error. |
| integer | $parent | The parent WordPress object. |
| string | $status | The log status. |
add(string $title = '', string $message = '', integer $parent, string $type = 'salesforce') : integer
Create new log entry
This is just a simple and fast way to log something. Use self::insert_log() if you need to store custom meta data
| string | $title | A log post title. |
| string | $message | The log message. |
| integer | $parent | The parent WordPress object. |
| string | $type | The type of log message; defaults to 'salesforce'. |
The ID of the new log entry
get_logs(integer $object_id, string $type = 'salesforce', integer $paged = null) : array
Easily retrieves log items for a particular object ID
| integer | $object_id | A WordPress object ID. |
| string | $type | The type of log item; defaults to 'salesforce' because that's the type of logs we create. |
| integer | $paged | Which page of results do we want? |
get_connected_logs(Array $args = array()) : array
Retrieve all connected logs
Used for retrieving logs related to particular items, such as a specific purchase.
| Array | $args | An array of arguments for get_posts(). |
/ false
get_log_count(integer $object_id, string $type = 'salesforce', Array $meta_query = null) : integer
Retrieves number of log entries connected to particular object ID
| integer | $object_id | A WordPress object ID. |
| string | $type | The type of log item; defaults to 'salesforce' because that's the type of logs we create. |
| Array | $meta_query | A WordPress meta query, parseable by WP_Meta_Query. |