warning( sprintf( 'Cloudflare image gen %s failure (attempt %d/%d): %s', $failure_class, $attempt, PRAUTOBLOGGER_MAX_RETRIES, $detail ), 'cloudflare-image' ); } /** * Log an unrecoverable 4xx with triage context. Never logs the full * secret — only a 4-char token prefix and a 6-char account prefix. * * @param int $status HTTP status returned by Cloudflare. * @param string $api_token Plaintext token. * @param string $account_id Account UUID. * @param string $raw Raw response body (truncated to 300 chars in the log). * @return void */ public function log_client_error( int $status, string $api_token, string $account_id, string $raw ): void { PRAutoBlogger_Logger::instance()->error( sprintf( 'Cloudflare image gen HTTP %d (token_prefix=%s, token_len=%d, account=%s): %s', $status, substr( $api_token, 0, 4 ), strlen( $api_token ), substr( $account_id, 0, 6 ), substr( $raw, 0, 300 ) ), 'cloudflare-image' ); } }