fix(logger): route warn-level events to Hypercart_Logger::warning()#39
Open
mrtwebdesign wants to merge 2 commits into
Open
fix(logger): route warn-level events to Hypercart_Logger::warning()#39mrtwebdesign wants to merge 2 commits into
mrtwebdesign wants to merge 2 commits into
Conversation
The logging bridge checked for and called a warn() method, but the Hypercart Helper logger exposes warning(). The method_exists() guard always failed, so every warn-level event — including slow_query, the most common event in observe mode — silently fell back to error_log() instead of reaching wp-content/hypercart-logs/. Prefer warning() in both the main plugin and the mutex guard bridge, keeping warn() as a fallback for any string-only/legacy logger. Make the test mock faithful to the real class and add regression coverage pinning warn-level routing through to warning(). Also corrects the log() docblock to attribute the logger to the Helper plugin. Closes #7 Refs #6 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e Monitor Hypercart_Logger is defined in Hypercart-Helper-WP-plugin; the Performance Monitor plugin only consumes it. Update the README logging section so it points to the plugin that actually defines the class. Closes #6 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QueryGuard's logging bridge checked for and called a
warn()method, but the Hypercart Helper logger (Hypercart-Helper-WP-plugin/includes/class-hypercart-logger.php) exposeswarning(). Themethod_exists()guard therefore always returnedfalse, so every warn-level event — includingslow_query, the most common event in observe mode — silently fell back toerror_log()instead of landing inwp-content/hypercart-logs/.infoanderrorrouted correctly; onlywarnwas broken.This was confirmed against ~48h of binoidcbd production logs: 551
slow_queryevents, all in the WP Engine PHP error log, none in the Helper log files.Changes
hypercart-query-guard.php— bridge now prefersHypercart_Logger::warning(), withwarn()kept as a fallback for any string-only/legacy logger. Docblock attribution corrected to the Helper plugin.class-hcqg-mutex-guard.php— same bridge bug fixed (it logs kill/mutex events).README.md— logging section now credits the Hypercart Helper plugin, not the Performance Monitor.Hypercart_Loggermade faithful to the real class (warning), newtest_warn_level_routes_to_hypercart_logger_warningregression, and the end-to-endDbDropinTestassertion updated. Full suite green: 86 tests, 166 assertions.Scope notes
warn→warningrename and the publicWARN_THRESHOLD_MS/HYPERCART_QUERY_GUARD_WARN_THRESHOLD_MSconfig constant is untouched.shutdownhook, well after the Helper plugin loads, soHypercart_Loggeris available when these events are written.db.php) and the Hypercart Helper plugin must be active.Issues
Closes #7
Closes #6
🤖 Generated with Claude Code