Skip to content

feat(logging): add a search bar to the All Logs page - #864

Open
josephfusco wants to merge 5 commits into
mainfrom
feat/logging-search
Open

josephfusco wants to merge 5 commits into
mainfrom
feat/logging-search

Conversation

@josephfusco

@josephfusco josephfusco commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Adds a search box to the All Logs page that matches the log message and GraphQL query, and keeps search and filters in the URL across pages. Sites that override the filters template now need to output the wpgraphql_logging_nonce field.

Closes #484

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with implementing the logs search bar.

Adds the standard WP_List_Table search box to the logs list. The term is
matched with a LIKE against the message column and the top-level query in
the context JSON, and composes with the date and level filters.

The filter form now posts the filter nonce so that searches and filters are
redirected to GET, which keeps them in the pagination and sorting links.
@josephfusco josephfusco added the [Type] Enhancement A suggestion for improvement of an existing feature label Oct 30, 2026
@josephfusco josephfusco added this to the WPGraphQL Logging Plugin milestone Oct 30, 2026
@josephfusco josephfusco added the [Area] Logging Issues for the WPGraphQL Logging plugin label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 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

add_query_arg() does not encode values, so a search term with "&", "#" or
"+" split into extra query args, and wp_safe_redirect() stripped characters
such as "$" and "{" that appear in GraphQL queries. Encode the filter and
search values in both the filter redirect and the bulk action redirect.
Adds wpunit coverage for quotes and backslashes in searched queries and for
telling bulk actions apart from filter submits, plus a Playwright spec for
searching the logs list and combining search with the level filter.
Moves the search and filter request keys to ViewLogsPage::FILTER_KEYS, so the
filter redirect, the page-number check and the bulk action redirect use the
same list. Documents the search box in the admin guide, and the search where
condition in the custom log store guide.
@josephfusco
josephfusco marked this pull request as ready for review October 30, 2026 19:56
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners October 30, 2026 19:56
@josephfusco
josephfusco requested a balanced review from Copilot November 2, 2026 14:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Nonempty log searches fail with an undefined-function error when ext-mbstring is unavailable because the new mb_strtolower() call has no declared dependency or fallback.

1 open issue
What changed in this PR

Adds message and GraphQL query search to the All Logs page, addressing #484 while preserving search and filters during navigation.

Changes:

  • Adds case-insensitive database search and a search condition contract for custom log stores.
  • Preserves search and filters in URLs, including after bulk actions.
  • Adds unit and browser tests, plus user and developer documentation.
File Description
plugins/​wpgraphql-logging/​tests/​wpunit/​Logger/​Database/​WordPressDatabaseLogServiceTest.php Tests search matching, escaping, filters, and counts.
plugins/​wpgraphql-logging/​tests/​wpunit/​Admin/​View/​ViewLogsPageTest.php Tests URL encoding, pagination, and bulk-action handling.
plugins/​wpgraphql-logging/​tests/​wpunit/​Admin/​View/​List/​ListTableTest.php Tests search sanitization and service arguments.
plugins/​wpgraphql-logging/​tests/​e2e/​specs/​search-logs.spec.js Covers searching, combined filters, and empty results.
plugins/​wpgraphql-logging/​src/​Logger/​Database/​WordPressDatabaseLogService.php Implements message and GraphQL query search.
plugins/​wpgraphql-logging/​src/​Logger/​Api/​LogServiceInterface.php Defines the search pseudo-column contract.
plugins/​wpgraphql-logging/​src/​Admin/​ViewLogsPage.php Preserves search state through encoded redirects.
plugins/​wpgraphql-logging/​src/​Admin/​View/​Templates/​WPGraphQLLoggerList.php Renders the search box.
plugins/​wpgraphql-logging/​src/​Admin/​View/​Templates/​WPGraphQLLoggerFilters.php Restores filter values and adds the filter nonce.
plugins/​wpgraphql-logging/​src/​Admin/​View/​List/​ListTable.php Builds search conditions and preserves bulk-action filters.
docs/​plugins/​wpgraphql-logging/​index.md Explains search behavior and performance considerations.
docs/​plugins/​wpgraphql-logging/​how-to/​update-log-store-service/​index.md Documents search support for custom log stores.

Review effort: Balanced

…r dependency in log search'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Logging Issues for the WPGraphQL Logging plugin [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(logging): Add a search bar to the listing page

2 participants