fix(2meet-data-optimizer): keep the audit trail of mode changes and snapshot deletions

- TMDO_Logger::notice() is always written to the error log (it had no
  callers); bridge_mode_changed and snapshot_deleted use it. Since PR-095
  info() is silent without WP_DEBUG_LOG, which left no record of who switched
  a mode or deleted a snapshot (security review L1)
- Verify: LoggerTest (notice always logged, info gated), unit 703,
  integration 585, phpcs, stan
- PR: PR-113 (2.3 acceptance security review)
This commit is contained in:
2026-09-27 17:25:56 +08:00
parent 29adb05567
commit e26aadc4ec
4 changed files with 16 additions and 12 deletions
+6 -5
View File
@@ -77,15 +77,16 @@ class TMDO_Logger {
}
/**
* Log a NOTICE-level event — alias of info() for callers that want a stronger
* level intent. Same routing (error_log only).
* Log a NOTICE-level event: always written to the PHP error log (unlike
* info()), for the audit trail of operator actions such as mode changes
* and snapshot deletions.
*
* @param string $event Event name.
* @param array $context Structured context.
* @param string $event Event name.
* @param array<string, mixed> $context Structured context.
* @return void
*/
public static function notice( string $event, array $context = array() ): void {
self::info( $event, $context );
error_log( sprintf( '[WPDO][NOTICE][%s] %s', $event, $context ? wp_json_encode( $context, JSON_UNESCAPED_UNICODE ) : '' ) );
}
/**