Request Logging

The @log decorator provides automatic, comprehensive logging for your API endpoints.

The @log Decorator

Logs the complete lifecycle of a request, including arguments on entry and return values (or exceptions) on exit.

routes/users.py
from jec_api.decorators import log

class Users(Route):
    @log
    async def get(self, user_id: int):
        # Logs: [CALL] Users.get | args=(user_id=1,)
        # ... processing ...
        # Logs: [RETURN] Users.get | result={...}
        return db.get_user(user_id)

Need more control over log levels, truncation, or privacy? Check the Advanced Usage guide.