(self, record)
Emit a record.

        Send the record to the web server as a percent-encoded dictionary
Emit a record.
Emit a record .
def emit(self, record):
        """
        Emit a record.

        Send the record to the web server as a percent-encoded dictionary
        """
        try:
            import urllib.parse
            host = self.host
            h = self.getConnection(host, self.secure)
            url = self.url
            data = urllib.parse.urlencode(self.mapLogRecord(record))
            if self.method == "GET":
                if (url.find('?') >= 0):
                    sep = '&'
                else:
                    sep = '?'
                url = url + "%c%s" % (sep, data)
            h.putrequest(self.method, url)
            # support multiple hosts on one IP address...
            # need to strip optional :port from host, if present
            i = host.find(":")
            if i >= 0:
                host = host[:i]
            # See issue #30904: putrequest call above already adds this header
            # on Python 3.x.
            # h.putheader("Host", host)
            if self.method == "POST":
                h.putheader("Content-type",
                            "application/x-www-form-urlencoded")
                h.putheader("Content-length", str(len(data)))
            if self.credentials:
                import base64
                s = ('%s:%s' % self.credentials).encode('utf-8')
                s = 'Basic ' + base64.b64encode(s).strip().decode('ascii')
                h.putheader('Authorization', s)
            h.endheaders()
            if self.method == "POST":
                h.send(data.encode('utf-8'))
            h.getresponse()    #can't do anything with the result
        except Exception:
            self.handleError(record)
def emit ( self , record ) : try : import urllib . parse host = self . host h = self . getConnection ( host , self . secure ) url = self . url data = urllib . parse . urlencode ( self . mapLogRecord ( record ) ) if self . method == "GET" : if ( url . find ( '?' ) >= 0 ) : sep = '&' else : sep = '?' url = url + "%c%s" % ( sep , data ) h . putrequest ( self . method , url ) # support multiple hosts on one IP address... # need to strip optional :port from host, if present i = host . find ( ":" ) if i >= 0 : host = host [ : i ] # See issue #30904: putrequest call above already adds this header # on Python 3.x. # h.putheader("Host", host) if self . method == "POST" : h . putheader ( "Content-type" , "application/x-www-form-urlencoded" ) h . putheader ( "Content-length" , str ( len ( data ) ) ) if self . credentials : import base64 s = ( '%s:%s' % self . credentials ) . encode ( 'utf-8' ) s = 'Basic ' + base64 . b64encode ( s ) . strip ( ) . decode ( 'ascii' ) h . putheader ( 'Authorization' , s ) h . endheaders ( ) if self . method == "POST" : h . send ( data . encode ( 'utf-8' ) ) h . getresponse ( ) #can't do anything with the result except Exception : self . handleError ( record )