LOGGER dumps data in Client._request even if level is set to ERROR

Issue #62 open
Anonymous created an issue

When struggling with performances issues (0.6s for Client.get_torrents() on a single core little server with +- 300 torrents), I found that LOGGER.debug always dumps data in Client._request. The operation takes half the time of Client._request

A solution:

# checks if LOGGER has some handler
def is_logger_configured(name):
    logger = logging.getLogger(name)
    return len(logger.handlers) != 0

# if LOGGER has handler, dump data
if is_logger_configured("transmissionrpc"):
    LOGGER.debug(json.dumps(data, indent=2))

Comments (3)

  1. Log in to comment