public function getSessionId()
    {
        if($this->startSession && !$this->session->isStarted()) {
            $this->session->start();
        }

        if ($this->session->isStarted()) {
            // We assume the sessionId contains data and has to be protected,
            // so we use a salted SHA1 checksum.
            return sha1($this->secret . $this->session->getId());
            // In the end this method will be called for _each_ log message.
            // If the session id would be constant and accessible through the whole request,
            // this would not be necessary.
        }

        return null;
    }