Browse Source

renamed log property in CMServerList

pull/41/head
Rossen Georgiev 9 years ago
parent
commit
19b8272647
  1. 20
      steam/core/cm.py

20
steam/core/cm.py

@ -390,7 +390,7 @@ class CMServerList(object):
Bad = 2 Bad = 2
def __init__(self, bad_timespan=300): def __init__(self, bad_timespan=300):
self._log = logging.getLogger("CMServerList") self._LOG = logging.getLogger("CMServerList")
self.bad_timespan = bad_timespan self.bad_timespan = bad_timespan
self.list = defaultdict(dict) self.list = defaultdict(dict)
@ -400,7 +400,7 @@ class CMServerList(object):
def clear(self): def clear(self):
"""Clears the server list""" """Clears the server list"""
if len(self.list): if len(self.list):
self._log.debug("List cleared.") self._LOG.debug("List cleared.")
self.list.clear() self.list.clear()
def bootstrap_from_builtin_list(self): def bootstrap_from_builtin_list(self):
@ -408,7 +408,7 @@ class CMServerList(object):
Resets the server list to the built in one. Resets the server list to the built in one.
This method is called during initialization. This method is called during initialization.
""" """
self._log.debug("Bootstraping from builtin list") self._LOG.debug("Bootstraping from builtin list")
self.clear() self.clear()
# build-in list # build-in list
@ -438,23 +438,23 @@ class CMServerList(object):
:return: booststrap success :return: booststrap success
:rtype: :class:`bool` :rtype: :class:`bool`
""" """
self._log.debug("Attempting bootstrap via WebAPI") self._LOG.debug("Attempting bootstrap via WebAPI")
from steam import _webapi from steam import _webapi
try: try:
resp = _webapi.get('ISteamDirectory', 'GetCMList', 1, params={'cellid': cellid}) resp = _webapi.get('ISteamDirectory', 'GetCMList', 1, params={'cellid': cellid})
except Exception as exp: except Exception as exp:
self._log.error("WebAPI boostrap failed: %s" % str(exp)) self._LOG.error("WebAPI boostrap failed: %s" % str(exp))
return False return False
result = EResult(resp['response']['result']) result = EResult(resp['response']['result'])
if result != EResult.OK: if result != EResult.OK:
self._log.error("GetCMList failed with %s" % repr(result)) self._LOG.error("GetCMList failed with %s" % repr(result))
return False return False
serverlist = resp['response']['serverlist'] serverlist = resp['response']['serverlist']
self._log.debug("Recieved %d servers from WebAPI" % len(serverlist)) self._LOG.debug("Recieved %d servers from WebAPI" % len(serverlist))
def str_to_tuple(serveraddr): def str_to_tuple(serveraddr):
ip, port = serveraddr.split(':') ip, port = serveraddr.split(':')
@ -484,7 +484,7 @@ class CMServerList(object):
def reset_all(self): def reset_all(self):
"""Reset status for all servers in the list""" """Reset status for all servers in the list"""
self._log.debug("Marking all CMs as Good.") self._LOG.debug("Marking all CMs as Good.")
for key in self.list: for key in self.list:
self.mark_good(key) self.mark_good(key)
@ -503,7 +503,7 @@ class CMServerList(object):
:param server_addr: (ip, port) tuple :param server_addr: (ip, port) tuple
:type server_addr: :class:`tuple` :type server_addr: :class:`tuple`
""" """
self._log.debug("Marking %s as Bad." % repr(server_addr)) self._LOG.debug("Marking %s as Bad." % repr(server_addr))
self.list[server_addr].update({'quality': CMServerList.Bad, 'timestamp': time()}) self.list[server_addr].update({'quality': CMServerList.Bad, 'timestamp': time()})
def merge_list(self, new_list): def merge_list(self, new_list):
@ -519,4 +519,4 @@ class CMServerList(object):
self.mark_good((ip, port)) self.mark_good((ip, port))
if len(self.list) > total: if len(self.list) > total:
self._log.debug("Added %d new CM addresses." % (len(self.list) - total)) self._LOG.debug("Added %d new CM addresses." % (len(self.list) - total))

Loading…
Cancel
Save