class Loggable:
def __init__(self, log, log_to_console: bool = False, prefix: str = ""):
-
self._last_log_time = None # used for time increment in logging
self._log_to_console = log_to_console
self._prefix = prefix
include_thread: bool = False,
include_coroutine: bool = True,
) -> str:
-
# time increment from last log
now = time.perf_counter()
if self._last_log_time is None:
coroutine_id = ""
if include_coroutine:
try:
- if asyncio.Task.current_task() is not None:
+ if asyncio.current_task() is not None:
def print_cor_name(c):
import inspect
except Exception:
pass
- coro = asyncio.Task.current_task()._coro
+ coro = asyncio.current_task()._coro
coroutine_id = "coro-{} {}()".format(
hex(id(coro))[2:], print_cor_name(coro)
)