skillfed

logdecorator

Move logging code out of your business logic with decorators

logdecorator v2.5 103.1K downloads/30d#12,827 on PyPI82
Permissive license DORMANT released

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 on this page — 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

logdecorator on PyPI

pip

pip install logdecorator

uv

uv add logdecorator

poetry

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 the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 545 days since the last release
Last repo commit
First released
Downloads 103,146/month — #12,827 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: logdecorator-2.5-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: System :: Logging

Tags

python function logging decoratorsadd logging without code clutterdecorator-based logginglog function entry exiterror logging decoratorsasync function loggingclean logging patterns
loggingdecoratorsasync-support

More Software Development packages