--- id: logdecorator version: "2.5" license: unclear license_treatment: permissive maintenance: dormant --- # logdecorator — Move logging code out of your business logic with decorators License: permissive · Maintenance: dormant · Downloads: 103.1K/mo ## What it is and what it does Logdecorator is a lightweight decorator library that attaches logging to Python functions without embedding log statements in business logic. It provides four main decorators—log_on_start, log_on_end, log_on_error, and log_exception—that trigger at corresponding points in function execution, plus async variants for coroutines. Messages support Python format strings with access to function arguments, return values, and exception objects, keeping code readable while maintaining comprehensive logging coverage. The library targets developers who want logging instrumentation without the visual noise of try-except blocks or logger calls scattered through their code. With zero runtime dependencies and a simple decorator-based API, it integrates into existing Python projects with minimal friction. It requires Python 3.10 or later and is maintained under a permissive MIT license. Use it for: - Wrap API endpoint handlers to log incoming requests and outgoing responses without polluting handler code. - Decorate data processing functions to track execution flow and timing across a data pipeline. - Add error logging to utility functions that should fail loudly but keep their implementation clean. - Instrument async tasks to log lifecycle events (start, completion, failure) in concurrent applications. - Create audit trails for sensitive operations by logging arguments and results at function boundaries. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Logdecorator provides Python decorators to add logging to functions without cluttering business logic—log at function start, end, or on errors using simple decorator syntax. Yes, if you want a lightweight, zero-dependency way to add structured logging to functions without embedding log statements in business logic. The dormant maintenance status (last release 545 days ago) is a minor concern for a stable utility library, but verify that async decorator support and format-string behavior match your logging patterns before committing to it in a new project. ## Install pip install logdecorator uv add logdecorator poetry add logdecorator ## Installing logdecorator Before you install: Low friction installation with no runtime dependencies. Maintenance is dormant—last release was 545 days ago, though the repository remains active with a recent commit on 2025-02-15 and modest community interest (82 stars). License in practice: MIT license (permissive) means you can use, modify, and distribute logdecorator freely in commercial and private projects with minimal restrictions. Quickstart: pip install logdecorator import logging from logdecorator import log_on_start, log_on_end, log_on_error @log_on_start(logging.DEBUG, "Starting {url}") @log_on_end(logging.DEBUG, "Finished {url}") @log_on_error(logging.ERROR, "Error: {e!r}") def download(url): pass logging.basicConfig(level=logging.DEBUG) download("https://example.com") Requires Python 3.10 or later. Verify before relying: - Whether async decorator support (async_log_on_start, etc.) is fully documented and stable. - Performance impact of decorator overhead on frequently-called functions. - Compatibility with popular logging frameworks beyond the standard library. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: dormant - Downloads: 103.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python function logging decorators, add logging without code clutter, decorator-based logging, log function entry exit, error logging decorators, async function logging, clean logging patterns, logging, decorators, async-support [View on SkillFed](https://skillfed.io/packages/logdecorator) · [View on PyPI](https://pypi.org/project/logdecorator/)