Demonstrates transparent async support — @log_call and @catch automatically detect async def functions.
@log_call — works with async def without a separate decorator@catch — suppresses exceptions in async functionsasyncio.gather — concurrent execution, all calls loggedpip install nfo
python examples/async-usage/main.py
from nfo import log_call, catch
@log_call
async def fetch_data(url: str) -> dict:
await asyncio.sleep(0.05)
return {"url": url, "status": 200}
@catch(default={})
async def risky_fetch(url: str) -> dict:
if "bad" in url:
raise ConnectionError(f"Cannot connect to {url}")
return {"url": url, "data": "ok"}
No special async decorator needed — nfo detects async def via inspect.iscoroutinefunction().