Replace logger by _logger in servers
This commit is contained in:
parent
05d20ed6ee
commit
7a4b27510c
@ -53,7 +53,7 @@ class DCC(server.AbstractServer):
|
||||
self.port = self.foundPort()
|
||||
|
||||
if self.port is None:
|
||||
self.logger.critical("No more available slot for DCC connection")
|
||||
self._logger.critical("No more available slot for DCC connection")
|
||||
self.setError("Il n'y a plus de place disponible sur le serveur"
|
||||
" pour initialiser une session DCC.")
|
||||
|
||||
@ -79,7 +79,7 @@ class DCC(server.AbstractServer):
|
||||
self.s = socket.socket()
|
||||
try:
|
||||
self.s.connect((host, port))
|
||||
self.logger.info("Accepted user from %s:%d for %s", host, port, self.sender)
|
||||
self._logger.info("Accepted user from %s:%d for %s", host, port, self.sender)
|
||||
self.connected = True
|
||||
self.stop = False
|
||||
except:
|
||||
@ -104,7 +104,7 @@ class DCC(server.AbstractServer):
|
||||
self.setError("Une erreur s'est produite durant la tentative"
|
||||
" d'ouverture d'une session DCC.")
|
||||
return False
|
||||
self.logger.info("Listening on %d for %s", self.port, self.sender)
|
||||
self._logger.info("Listening on %d for %s", self.port, self.sender)
|
||||
|
||||
#Send CTCP request for DCC
|
||||
self.srv.send_ctcp(self.sender,
|
||||
@ -115,7 +115,7 @@ class DCC(server.AbstractServer):
|
||||
s.listen(1)
|
||||
#Waiting for the client
|
||||
(self.s, addr) = s.accept()
|
||||
self.logger.info("Connected by %d", addr)
|
||||
self._logger.info("Connected by %d", addr)
|
||||
self.connected = True
|
||||
return True
|
||||
|
||||
@ -149,7 +149,7 @@ class DCC(server.AbstractServer):
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
self.logger.error("File not found `%s'", filename)
|
||||
self._logger.error("File not found `%s'", filename)
|
||||
|
||||
def run(self):
|
||||
self.stopping.clear()
|
||||
@ -202,7 +202,7 @@ class DCC(server.AbstractServer):
|
||||
if self.realname in self.srv.dcc_clients:
|
||||
del self.srv.dcc_clients[self.realname]
|
||||
|
||||
self.logger.info("Closing connection with %s", self.nick)
|
||||
self._logger.info("Closing connection with %s", self.nick)
|
||||
self.stopping.set()
|
||||
if self.closing_event is not None:
|
||||
self.closing_event()
|
||||
|
@ -84,13 +84,13 @@ class _IRC:
|
||||
except:
|
||||
return "ERRMSG invalid parameters provided as DCC CTCP request"
|
||||
|
||||
self.logger.info("Receive DCC connection request from %s to %s:%d", conn.sender, ip, port)
|
||||
self._logger.info("Receive DCC connection request from %s to %s:%d", conn.sender, ip, port)
|
||||
|
||||
if conn.accept_user(ip, port):
|
||||
srv.dcc_clients[conn.sender] = conn
|
||||
conn.send_dcc("Hello %s!" % conn.nick)
|
||||
else:
|
||||
self.logger.error("DCC: unable to connect to %s:%d", ip, port)
|
||||
self._logger.error("DCC: unable to connect to %s:%d", ip, port)
|
||||
return "ERRMSG unable to connect to %s:%d" % (ip, port)
|
||||
|
||||
import nemubot
|
||||
@ -109,7 +109,7 @@ class _IRC:
|
||||
# TODO: Temporary fix, waiting for hook based CTCP management
|
||||
self.ctcp_capabilities["TYPING"] = lambda msg, cmds: None
|
||||
|
||||
self.logger.debug("CTCP capabilities setup: %s", ", ".join(self.ctcp_capabilities))
|
||||
self._logger.debug("CTCP capabilities setup: %s", ", ".join(self.ctcp_capabilities))
|
||||
|
||||
|
||||
# Register hooks on some IRC CMD
|
||||
|
@ -32,10 +32,11 @@ class AbstractServer:
|
||||
"""
|
||||
|
||||
self._name = name
|
||||
self._socket = socket
|
||||
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.logger = logging.getLogger("nemubot.server." + str(self.name))
|
||||
self._logger = logging.getLogger("nemubot.server." + str(self.name))
|
||||
self._readbuffer = b''
|
||||
self._sending_queue = queue.Queue()
|
||||
|
||||
@ -53,7 +54,7 @@ class AbstractServer:
|
||||
def connect(self, *args, **kwargs):
|
||||
"""Register the server in _poll"""
|
||||
|
||||
self.logger.info("Opening connection")
|
||||
self._logger.info("Opening connection")
|
||||
|
||||
super().connect(*args, **kwargs)
|
||||
|
||||
@ -66,7 +67,7 @@ class AbstractServer:
|
||||
def close(self, *args, **kwargs):
|
||||
"""Unregister the server from _poll"""
|
||||
|
||||
self.logger.info("Closing connection")
|
||||
self._logger.info("Closing connection")
|
||||
|
||||
if self.fileno() > 0:
|
||||
sync_act("sckt", "unregister", self.fileno())
|
||||
@ -84,7 +85,7 @@ class AbstractServer:
|
||||
"""
|
||||
|
||||
self._sending_queue.put(self.format(message))
|
||||
self.logger.debug("Message '%s' appended to write queue", message)
|
||||
self._logger.debug("Message '%s' appended to write queue", message)
|
||||
sync_act("sckt", "write", self.fileno())
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ class _SocketServer(_Socket):
|
||||
|
||||
|
||||
def connect(self):
|
||||
self.logger.info("Connection to %s:%d", *self._sockaddr[:2])
|
||||
self._logger.info("Connection to %s:%d", *self._sockaddr[:2])
|
||||
super().connect(self._sockaddr)
|
||||
|
||||
if self._bind:
|
||||
@ -114,7 +114,7 @@ class UnixSocket:
|
||||
|
||||
|
||||
def connect(self):
|
||||
self.logger.info("Connection to unix://%s", self._socket_path)
|
||||
self._logger.info("Connection to unix://%s", self._socket_path)
|
||||
super().connect(self._socket_path)
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ class _Listener:
|
||||
def read(self):
|
||||
conn, addr = self.accept()
|
||||
fileno = conn.fileno()
|
||||
self.logger.info("Accept new connection from %s (fd=%d)", addr, fileno)
|
||||
self._logger.info("Accept new connection from %s (fd=%d)", addr, fileno)
|
||||
|
||||
ss = self._instanciate(name=self.name + "#" + str(fileno), fileno=conn.detach())
|
||||
ss.connect = ss._on_connect
|
||||
@ -152,7 +152,7 @@ class UnixSocketListener(_Listener, UnixSocket, _Socket, socket.socket):
|
||||
|
||||
|
||||
def connect(self):
|
||||
self.logger.info("Creating Unix socket at unix://%s", self._socket_path)
|
||||
self._logger.info("Creating Unix socket at unix://%s", self._socket_path)
|
||||
|
||||
try:
|
||||
os.remove(self._socket_path)
|
||||
@ -161,7 +161,7 @@ class UnixSocketListener(_Listener, UnixSocket, _Socket, socket.socket):
|
||||
|
||||
self.bind(self._socket_path)
|
||||
self.listen(5)
|
||||
self.logger.info("Socket ready for accepting new connections")
|
||||
self._logger.info("Socket ready for accepting new connections")
|
||||
|
||||
self._on_connect()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user