yaboli/info.txt
2019-04-06 23:44:42 +00:00

39 lines
838 B
Text

Signature of a normal function:
def a(b: int, c: str) -> bool:
pass
a # type: Callable[[int, str], bool]
Signature of an async function:
async def a(b: int, c: str) -> bool:
pass
a # type: Callable[[int, str], Awaitable[bool]]
Enable logging (from the websockets docs):
import logging
logger = logging.getLogger('websockets')
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler())
Output format: See https://docs.python.org/3/library/logging.html#formatter-objects
Example formatting:
FORMAT = "{asctime} [{levelname:<7}] <{name}> {funcName}(): {message}"
DATE_FORMAT = "%F %T"
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter(
fmt=FORMAT,
datefmt=DATE_FORMAT,
style="{"
))
logger = logging.getLogger('yaboli')
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)