From a2097be1384ddb215bbb6404cee2a0285cf2bbe2 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Thu, 8 Jun 2017 02:51:29 +0300 Subject: [PATCH] uasyncio: Add own set_debug() function. set_debug() from uasyncio.core doesn't have effect on the main uasyncio package, so let them both have set_debug() function, and allow to enable debug logging independently. --- uasyncio/uasyncio/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/uasyncio/uasyncio/__init__.py b/uasyncio/uasyncio/__init__.py index b6b3e6d7..b6046e98 100644 --- a/uasyncio/uasyncio/__init__.py +++ b/uasyncio/uasyncio/__init__.py @@ -4,6 +4,17 @@ import usocket as _socket from uasyncio.core import * +DEBUG = 0 +log = None + +def set_debug(val): + global DEBUG, log + DEBUG = val + if val: + import logging + log = logging.getLogger("uasyncio") + + class PollEventLoop(EventLoop): def __init__(self, len=42):