@@ -84,6 +84,9 @@ public function bounceCurrentIp(): void
8484 $ forcedTestIp = $ this ->getConfig ('forced_test_ip ' );
8585 $ ip = $ forcedTestIp ?: $ this ->getRemoteIp ();
8686 $ ip = $ this ->handleForwardedFor ($ ip , $ this ->configs );
87+ $ this ->logger ->info ('Bouncing current IP ' , [
88+ 'ip ' => $ ip ,
89+ ]);
8790 $ remediation = $ this ->getRemediationForIp ($ ip );
8891 $ this ->handleRemediation ($ remediation , $ ip );
8992 }
@@ -356,9 +359,15 @@ protected function handleRemediation(string $remediation, string $ip): void
356359 {
357360 switch ($ remediation ) {
358361 case Constants::REMEDIATION_CAPTCHA :
362+ $ this ->logger ->debug ('Will display a captcha wall ' , [
363+ 'ip ' => $ ip ,
364+ ]);
359365 $ this ->handleCaptchaRemediation ($ ip );
360366 break ;
361367 case Constants::REMEDIATION_BAN :
368+ $ this ->logger ->debug ('Will display a ban wall ' , [
369+ 'ip ' => $ ip ,
370+ ]);
362371 $ this ->handleBanRemediation ();
363372 break ;
364373 case Constants::REMEDIATION_BYPASS :
@@ -454,11 +463,19 @@ private function capRemediationLevel(string $remediation): string
454463 $ maxRemediationLevel ,
455464 $ orderedRemediations
456465 );
466+ $ finalRemediation = $ remediation ;
457467 if ($ currentIndex < $ maxIndex ) {
458- return $ orderedRemediations [$ maxIndex ];
468+ $ finalRemediation = $ orderedRemediations [$ maxIndex ];
469+ $ this ->logger ->debug ('Original remediation has been capped ' , [
470+ 'origin ' => $ remediation ,
471+ 'final ' => $ finalRemediation
472+ ]);
459473 }
474+ $ this ->logger ->info ('Final remediation ' , [
475+ 'remediation ' => $ finalRemediation ,
476+ ]);
460477
461- return $ remediation ;
478+ return $ finalRemediation ;
462479 }
463480
464481 /**
@@ -614,6 +631,9 @@ private function handleCaptchaRemediation(string $ip): void
614631 if (null === $ cachedCaptchaVariables ['has_to_be_resolved ' ]) {
615632 // Set up the first captcha remediation.
616633 $ mustResolve = true ;
634+ $ this ->logger ->debug ('First captcha resolution ' , [
635+ 'ip ' => $ ip ,
636+ ]);
617637 $ this ->initCaptchaResolution ($ ip );
618638 }
619639
0 commit comments