Cleaned up amp debug output

This commit is contained in:
Griatch 2019-01-29 19:00:18 +01:00
parent 8246a060b9
commit 183e759824
3 changed files with 12 additions and 12 deletions

View file

@ -102,7 +102,7 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
Called when a new connection is established. Called when a new connection is established.
""" """
print("AMPClient new connection {}".format(self)) # print("AMPClient new connection {}".format(self))
info_dict = self.factory.server.get_info_dict() info_dict = self.factory.server.get_info_dict()
super(AMPServerClientProtocol, self).connectionMade() super(AMPServerClientProtocol, self).connectionMade()
# first thing we do is to request the Portal to sync all sessions # first thing we do is to request the Portal to sync all sessions
@ -129,7 +129,7 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
(sessid, kwargs). (sessid, kwargs).
""" """
print("server data_to_portal: {}, {}, {}".format(command, sessid, kwargs)) # print("server data_to_portal: {}, {}, {}".format(command, sessid, kwargs))
return self.callRemote(command, packed_data=amp.dumps((sessid, kwargs))).addErrback( return self.callRemote(command, packed_data=amp.dumps((sessid, kwargs))).addErrback(
self.errback, command.key) self.errback, command.key)

View file

@ -287,7 +287,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
""" """
Handle non-AMP messages, such as HTTP communication. Handle non-AMP messages, such as HTTP communication.
""" """
print("dataReceived: {}".format(data)) # print("dataReceived: {}".format(data))
if data[:1] == NUL: if data[:1] == NUL:
# an AMP communication # an AMP communication
if data[-2:] != NULNUL: if data[-2:] != NULNUL:
@ -310,7 +310,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
# not an AMP communication, return warning # not an AMP communication, return warning
self.transport.write(_HTTP_WARNING) self.transport.write(_HTTP_WARNING)
self.transport.loseConnection() self.transport.loseConnection()
print("HTTP received: %s" % data) print("HTTP received (the AMP port should not receive http, only AMP!) %s" % data)
def makeConnection(self, transport): def makeConnection(self, transport):
""" """
@ -330,7 +330,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
This is called when an AMP connection is (re-)established. AMP calls it on both sides. This is called when an AMP connection is (re-)established. AMP calls it on both sides.
""" """
print("connectionMade: {}".format(self)) # print("connectionMade: {}".format(self))
self.factory.broadcasts.append(self) self.factory.broadcasts.append(self)
def connectionLost(self, reason): def connectionLost(self, reason):
@ -343,7 +343,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
portal will continuously try to reconnect, showing the problem portal will continuously try to reconnect, showing the problem
that way. that way.
""" """
print("ConnectionLost: {}: {}".format(self, reason)) # print("ConnectionLost: {}: {}".format(self, reason))
try: try:
self.factory.broadcasts.remove(self) self.factory.broadcasts.remove(self)
except ValueError: except ValueError:
@ -362,7 +362,7 @@ class AMPMultiConnectionProtocol(amp.AMP):
""" """
e.trap(Exception) e.trap(Exception)
_LOGGER.log_err("AMP Error for {info}: {trcbck} {err}".format( _get_logger().log_err("AMP Error for {info}: {trcbck} {err}".format(
info=info, trcbck=e.getTraceback(), err=e.getErrorMessage())) info=info, trcbck=e.getTraceback(), err=e.getErrorMessage()))
def data_in(self, packed_data): def data_in(self, packed_data):

View file

@ -228,7 +228,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
Send a status stanza to the launcher. Send a status stanza to the launcher.
""" """
print("send status to launcher") # print("send status to launcher")
# print("self.get_status(): {}".format(self.get_status())) # print("self.get_status(): {}".format(self.get_status()))
if self.factory.launcher_connection: if self.factory.launcher_connection:
self.factory.launcher_connection.callRemote( self.factory.launcher_connection.callRemote(
@ -307,9 +307,9 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
self.factory.launcher_connection = self self.factory.launcher_connection = self
_, server_connected, _, _, _, _ = self.get_status() _, server_connected, _, _, _, _ = self.get_status()
logger.log_msg("Evennia Launcher->Portal operation %s:%s received" % (ord(operation), arguments)) # logger.log_msg("Evennia Launcher->Portal operation %s:%s received" % (ord(operation), arguments))
logger.log_msg("operation == amp.SSTART: {}: {}".format(operation == amp.SSTART, amp.loads(arguments))) # logger.log_msg("operation == amp.SSTART: {}: {}".format(operation == amp.SSTART, amp.loads(arguments)))
if operation == amp.SSTART: # portal start #15 if operation == amp.SSTART: # portal start #15
# first, check if server is already running # first, check if server is already running
@ -350,7 +350,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
self.factory.portal.shutdown() self.factory.portal.shutdown()
else: else:
logger.log_msg("Operation {} not recognized".format(operation)) logger.log_err("Operation {} not recognized".format(operation))
raise Exception("operation %(op)s not recognized." % {'op': operation}) raise Exception("operation %(op)s not recognized." % {'op': operation})
return {} return {}
@ -391,7 +391,7 @@ class AMPServerProtocol(amp.AMPMultiConnectionProtocol):
sessid, kwargs = self.data_in(packed_data) sessid, kwargs = self.data_in(packed_data)
logger.log_msg("Evennia Server->Portal admin data %s:%s received" % (sessid, kwargs)) # logger.log_msg("Evennia Server->Portal admin data %s:%s received" % (sessid, kwargs))
operation = kwargs.pop("operation") operation = kwargs.pop("operation")
portal_sessionhandler = self.factory.portal.sessions portal_sessionhandler = self.factory.portal.sessions