jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/373680 )

Change subject: Even more logging
......................................................................


Even more logging

Bug: T173888
Change-Id: I7f9f3cf0657af100c6ae3a8b2bfb5206b86514eb
---
M includes/LoginNotify.php
1 file changed, 30 insertions(+), 5 deletions(-)

Approvals:
  Niharika29: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php
index e8a527e..06376f1 100644
--- a/includes/LoginNotify.php
+++ b/includes/LoginNotify.php
@@ -161,9 +161,16 @@
         */
        private function isKnownSystemSlow( User $user, $subnet, $resultSoFar = 
null ) {
                $result = $this->checkUserAllWikis( $user, $subnet );
-               if ( $result === self::USER_KNOWN ) {
-                       return true;
-               }
+
+               $this->log->debug( 'Checking user {user} from {subnet} (result 
so far: {soFar}): {result}',
+                       [
+                               'function' => __METHOD__,
+                               'user' => $user->getName(),
+                               'subnet' => $subnet,
+                               'result' => $result,
+                               'soFar' => json_encode( $resultSoFar ),
+                       ]
+               );
 
                if ( $resultSoFar !== null ) {
                        $result = $this->mergeResults( $result, $resultSoFar );
@@ -186,7 +193,7 @@
                        return true;
                }
 
-               return false;
+               return $result === self::USER_KNOWN;
        }
 
        /**
@@ -640,10 +647,20 @@
                        $this->config->get( 'LoginNotifyAttemptsNewIP' ),
                        $this->config->get( 'LoginNotifyExpiryNewIP' )
                );
+               $message = '{count} failed login attempts for {user} from an 
unknown system';
                if ( $count ) {
                        $this->incrStats( 'fail.unknown.notifications' );
                        $this->sendNotice( $user, 'login-fail-new', $count );
+                       $message .= ', sending notification';
                }
+
+               $this->log->debug( $message,
+                       [
+                               'function' => __METHOD__,
+                               'count' => $count,
+                               'user' => $user->getName(),
+                       ]
+               );
        }
 
        /**
@@ -799,7 +816,15 @@
         */
        public function sendSuccessNoticeDeferred( User $user, $subnet, 
$resultSoFar ) {
                $isKnown = $this->isKnownSystemSlow( $user, $subnet, 
$resultSoFar );
-               if ( !$isKnown ) {
+               if ( $isKnown ) {
+                       $this->log->debug( 'Found data for user {user} from 
{subnet}',
+                               [
+                                       'function' => __METHOD__,
+                                       'user' => $user->getName(),
+                                       'subnet' => $subnet,
+                               ]
+                       );
+               } else {
                        $this->incrStats( 'success.notifications' );
                        $this->sendNotice( $user, 'login-success' );
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/373680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7f9f3cf0657af100c6ae3a8b2bfb5206b86514eb
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/LoginNotify
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Niharika29 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to