title: Symfony logout handler, differentiate between button hit and session expiration
body: <p>I got my custom logout handler which is the following:</p>
  
  <pre><code>namespace AppBundle\EventListener;
  
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
  use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
  use FOS\UserBundle\Model\UserManagerInterface;
  use Doctrine\ORM\EntityManager;
  use AppBundle\Entity\User;
  
  class LogoutListener implements LogoutHandlerInterface
  {
  protected $securityContext;
  protected $entityManager;
  protected $logger;
  
  public function __construct(TokenStorage $securityContext, EntityManager $entityManager, $logger)
  {
      $this-&gt;securityContext = $securityContext;
      $this-&gt;entityManager = $entityManager;
      $this-&gt;logger = $logger;
  }
  
  public function logout(Request $Request, Response $Response, TokenInterface $Token)
  {
      $em = $this-&gt;entityManager;
      $user = $this-&gt;securityContext-&gt;getToken()-&gt;getUser();
      $em-&gt;getConnection()-&gt;executeUpdate("UPDATE subjects SET edited_by = NULL
                    WHERE edited_by=" . $user-&gt;getId());
  
      $this-&gt;logger-&gt;makelog(1, 'Выход из системы');
  }
  </code></pre>
  
  <p>Here I log into a file all logout actions. Now I need to differentiate between user logout upon button hit, and session expiration. Any ideas how to do that? What service should I implement. Now logout upon session expiration is simply handled in config.yml</p>
  
  <pre><code>session:
      save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"
      cookie_lifetime: 3600
      gc_maxlifetime: 3600
  </code></pre>