This add-on enables connecting your MemberPress enabled website to your discord server. Now you can add/remove MemberPress members directly to your discord server roles, assign roles according to your member levels, unassign roles when they expire, change role when they change membership.
GNU General Public License v2.0
4
stars
1
forks
source link
Implement Enhanced API Logging in MemberPress-Discord Integration #151
Implement a robust logging system in our existing MemberPress-Discord integration plugin to capture detailed information about each API interaction. This includes requests, responses, error details, and user information, storing them in a newly created MySQL table ets_memberpress_discord_api_logs.
Note: do not save client_id, client_secret and bot token to DB.
Requirements:
Database Table Creation
Create a new MySQL table discord_api_logs with the following columns:
id (INT AUTO_INCREMENT, PRIMARY KEY)
api_endpoint (VARCHAR 255) // full url.
api_endpoint_version (VARCHAR 10) //
request_params (LONGTEXT) // serialise.
api_response_header (LONGTEXT)
api_response_body (LONGTEXT)
api_response_http_code (VARCHAR 5) // / we will add a search feature that will query this colum.
error_detail_code (VARCHAR 100)
error_message (TEXT) // we will add a search feature that will query this colum.
wp_user_id (INT) // / we will add a search feature that will query this colum.
discord_user_id (LONGINT) // / we will add a search feature that will query this colum.
datetime (DATETIME, DEFAULT CURRENT_TIMESTAMP) // we will add a search feature that will query this colum.
Logging Functionality:
Be capable of handling large data sets for request and response bodies.
Serialize complex data structures for storage.
Be invoked after every API call made in the plugin.
API Call Modification:
Modify the existing API calls in the plugin to include the logging function.
Ensure that:
Both successful and failed API interactions are logged.
Relevant user IDs (WordPress and Discord) are captured, where applicable.
Testing and Validation
Thoroughly test the logging mechanism to ensure accuracy and performance.
Include test cases covering different API scenarios, error conditions, and user actions.
Additional Notes
Consider implementing an index on frequently queried columns for performance optimization.
Review and ensure compatibility with the latest versions of WordPress, MemberPress, and the Discord API.
Plan for future scalability and potential enhancements to the logging system.
Set up a local or staging environment for development and testing before deployment.
Expected Deliverables:
Updated plugin code with the new logging system.
SQL script for creating the discord_api_logs table.
Objective
Implement a robust logging system in our existing MemberPress-Discord integration plugin to capture detailed information about each API interaction. This includes requests, responses, error details, and user information, storing them in a newly created MySQL table
ets_memberpress_discord_api_logs
.Note: do not save client_id, client_secret and bot token to DB.
Requirements:
Database Table Creation
Logging Functionality:
API Call Modification: Modify the existing API calls in the plugin to include the logging function. Ensure that:
Testing and Validation
Additional Notes
Expected Deliverables: