Developpez.com

Python

Choisissez la catégorie, puis la rubrique :

14.5.5.5 SocketHandler

14.5.5.5 SocketHandler

The SocketHandler class, located in the logging.handlers module, sends logging output to a network socket. The base class uses a TCP socket.

class SocketHandler( host, port)
Returns a new instance of the SocketHandler class intended to communicate with a remote machine whose address is given by host and port.

close( )
Closes the socket.

handleError( )

emit( )
Pickles the record's attribute dictionary and writes it to the socket in binary format. If there is an error with the socket, silently drops the packet. If the connection was previously lost, re-establishes the connection. To unpickle the record at the receiving end into a LogRecord, use the makeLogRecord() function.

handleError( )
Handles an error which has occurred during emit(). The most likely cause is a lost connection. Closes the socket so that we can retry on the next event.

makeSocket( )
This is a factory method which allows subclasses to define the precise type of socket they want. The default implementation creates a TCP socket (socket.SOCK_STREAM).

makePickle( record)
Pickles the record's attribute dictionary in binary format with a length prefix, and returns it ready for transmission across the socket.

send( packet)
Send a pickled string packet to the socket. This function allows for partial sends which can happen when the network is busy.

See About this document... for information on suggesting changes.
Netflix : Python est derrière chaque film que vous regardez, voici comment l'entreprise utilise le langage de programmation pour ses services
Une plateforme de recrutement s'intéresse aux tendances des ingénieurs en matière d'outils de développement, et note la montée en puissance de VS Code
Les tendances des développeurs pour 2019 font du Machine Learning la compétence clé et du JavaScript le langage le plus populaire
Apprendre à coder correctement - Un guide concis pour écrire un meilleur code, par Robat Williams, traduit par vavavoum74
Contacter le responsable de la rubrique Python

Partenaire : Hébergement Web