Skip to content

Conversation

@theodesp
Copy link
Member

@theodesp theodesp commented Oct 22, 2025

Description

This PR performs internal testing and validation of the WPGraphQL Logging Plugin to ensure it is ready for GA.

Fixes in the PR

  • Implemented BufferHandler to batch write database entries for performance
  • Implemented LogStoreService to remove hard dependencies of the Database services in the admin and various classes
  • Refactored Database and CRUD log services to use interfaces to make it easy to be exctended for other data storage solutions.
  • Added missing indexes for performance
  • Added filters for caching configuration
  • Better error handling
  • Added missing nonce for admin pages

Related Issue

#448

Dependant PRs

Type of Change

  • ✅ Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactoring (no functional changes)
  • 📄 Example update (no functional changes)
  • 📝 Documentation update
  • 🔍 Performance improvement
  • 🧪 Test update

How Has This Been Tested?

Screenshots

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the project's coding standards
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • Any dependent changes have been highlighted, merged or published

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2025

🦋 Changeset detected

Latest commit: 6c3eb8b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wpengine/wpgraphql-logging-wordpress-plugin Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link

github-actions bot commented Oct 22, 2025

📦 Plugin Artifacts Ready!

Download from GitHub Actions run

Available plugins:

  • ✅ wpgraphql-logging.zip

See the "Artifacts" section at the bottom of the Actions run page

colinmurphy and others added 21 commits October 22, 2025 18:34
…cks.

Expanded and clarified the readme.txt with detailed features, requirements, installation, and FAQ for the WPGraphQL Logging plugin beta release. Updated contributor list, license, and tested PHP/WP versions. Added and improved PHPDoc blocks in templates and event class for consistency. Renamed TESTING.md to docs/how-to/run_tests.md for better documentation structure. Minor description update in main plugin file.
Renamed admin view template files to use the WPGraphQLLogger* naming convention for consistency. Updated all references in code, documentation, and psalm.xml to match the new filenames.
Wrap CACHE_DURATION in apply_filters to allow customization of the configuration cache duration via the 'wpgraphql_logging_config_cache_duration' filter.
Introduces a filter 'wpgraphql_logging_allowed_orderby_columns' to whitelist allowed columns for ORDER BY in find_logs() queries, enhancing security against SQL injection. Documentation updated with usage details and examples; code now validates both column and direction, falling back to defaults if invalid values are provided.
Introduces Monolog's BufferHandler for database logging and adds the 'wpgraphql_logging_default_buffer_limit' filter to customize buffer size. Updates tests to flush buffer before asserting log counts and documents the new filter. Also adds an index for 'level_name' in the database entity.
Introduces LogEntityInterface defining the contract for log entities and implements it in WordPressDatabaseEntity, which provides methods for creating, saving, and managing log entries in a WordPress database. This lays the foundation for structured logging within the WPGraphQL Logging plugin.
Refactored LogEntityInterface to require a constructor and static from_array method, and removed the create method. Added LogServiceInterface for CRUD operations on log entities. Updated WordPressDatabaseEntity to implement the new interface, including a new constructor, from_array, and static get_table_name. Added WordPressDatabaseLogService to provide database-backed CRUD operations for log entities.
Replaces direct repository usage with LogStoreService for log retrieval in DownloadLogService, improving extensibility. Adds get_query() to LogEntityInterface and implements it in WordPressDatabaseEntity to extract GraphQL queries from log context. Updates related tests to use the new service and interface.
Replaces direct dependency on LogsRepository with LogServiceInterface in DataDeletionScheduler. Updates instantiation to use LogStoreService and modifies log deletion to use the new service method for improved abstraction and flexibility.
Replaces direct usage of LogsRepository with LogServiceInterface in ViewLogsPage for improved abstraction and flexibility. Updates method to retrieve logs via the log service and adds a protected getter for the log service instance. Removes unused LogsRepository import from the related test file.
@colinmurphy colinmurphy force-pushed the wpgraphql-logging-internal-testing-448 branch from af8a84c to 9b5ee54 Compare October 28, 2025 17:56
Replaces direct usage of DatabaseEntity with LogStoreService in WordPressDatabaseHandler. This change centralizes log entity creation and storage, improving maintainability and consistency.
… the plugin to use interface methods instead so developers can replace the service via the log store service.
colinmurphy and others added 20 commits October 31, 2025 12:19
Moved LoggingRuleInterface to a new Api namespace and updated all references accordingly. Cleaned up admin asset enqueuing logic, improved documentation in EventManager, and made minor code style improvements. No functional changes to logging logic.
Added jQuery UI CSS and JS, and the jQuery Timepicker Addon assets to the wpgraphql-logging plugin for enhanced date/time selection in the log view. Also moved the logging view JS file to a new directory and updated the ViewLogsPage PHP to reference the new assets.
…pengine/hwptoolkit into wpgraphql-logging-internal-testing-448
Implemented various improvements to the WPGraphQL Logging Plugin, including performance enhancements and better error handling.
@colinmurphy colinmurphy marked this pull request as ready for review November 4, 2025 17:59
@colinmurphy colinmurphy requested a review from a team as a code owner November 4, 2025 17:59
colinmurphy
colinmurphy previously approved these changes Nov 4, 2025
@colinmurphy colinmurphy added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit 79d4154 Nov 5, 2025
21 checks passed
@colinmurphy colinmurphy deleted the wpgraphql-logging-internal-testing-448 branch November 5, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants