2 Commits

Author SHA1 Message Date
9b1d653789 feat: WC-native logging + Add to phpList button on order page
Logging:
- Replace custom file logger with wc_get_logger() (source: woolist-phplist)
- Logs now appear in WooCommerce → Status → Logs, no filesystem access needed
- Remove log viewer / Clear Log from settings page (WC UI handles this)
- Keep "Enable debug logging" checkbox to control DEBUG-level verbosity

Order page meta box:
- New "phpList Sync" side meta box on every order edit page
- Works with both classic (shop_order) and HPOS (woocommerce_page_wc-orders)
- Shows billing email + dropdown of all configured lists
- "Add to phpList" button triggers AJAX subscribe, shows inline result
- Result and full API trace logged to WC logs under woolist-phplist source
- woolist-admin.js handles button state and response display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 08:00:05 +01:00
f4c9e39493 feat: add structured file-based logging with admin log viewer
- New WooList_Logger class writes to wp-content/uploads/woolist-logs/woolist.log
  - INFO level: subscription events, test connection results (always recorded)
  - ERROR level: API failures, config problems (always recorded + php error_log fallback)
  - DEBUG level: full request URLs (password redacted), raw responses, step-by-step
    flow (only when "Enable debug logging" is checked in settings)
  - Auto-rotates at 1 MB; log directory protected by .htaccess
- API class: logs every request URL (redacted) and raw response body at DEBUG,
  errors at ERROR; subscribe_email_to_list logs each step (lookup/create/add)
- Hooks class: logs hook fire, skip reasons, and sync intent at DEBUG/INFO/ERROR
- Shortcode class: logs AJAX submissions, coupon generation, and failures
- Admin: new Logging section with "Enable debug logging" checkbox;
  log viewer textarea (last 300 lines, dark theme) + Clear Log button
  both visible at bottom of WooCommerce → Settings → phpList tab

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-19 16:25:33 +01:00