MediaPress provides an easy to use logging API to allow plugin developers log and manipulate various MediaPress actions/events.
The table schema for the logging table is as shown below.
The table is named as ‘yourprefix_mpp_logs’ where yourprefix is the database prefix you are using. You can access the table name programatically using the following table
//get logs table name
//it is like dbprefix_mpp_logs where dbprefix is your database prefix
$log_table = mediapress()->get_table_name( 'logs' );
PS: There is no database model class associated with this table. We have done it on purpose.
API Functions: –
- mpp_log( $args ) :- Log an action
- mpp_incremental_log( $args, $by = 1 ) : – Logs an action, if duplicate, then only increments the value by given number
- mpp_delete_logs( $args ):- Delete one or more log entry
- mpp_log_exists( $args ):- Check if a log exists for the given condition. Returns the database row as object if exists or null if not.
- mpp_get_logs( $args ):- Get an array of logs
- mpp_get_logger():- Get the logger object