{"id":23992,"library":"logdecorator","title":"LogDecorator","description":"Move logging code out of your business logic with decorators. Lightweight library (v2.5) that provides @log_decorator and related decorators for automatic logging of function calls, arguments, results, and exceptions. Requires Python >=3.10. Stable release cadence (sporadic).","status":"active","version":"2.5","language":"python","source_language":"en","source_url":"https://github.com/sighalt/logdecorator","tags":["logging","decorators","utility"],"install":[{"cmd":"pip install logdecorator","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"The main decorator used for logging.","symbol":"log_decorator","correct":"from logdecorator import log_decorator"},{"note":"log_level is a constant, not a class. Wrong import path causes AttributeError.","wrong":"from logdecorator.LogDecorator import log_level","symbol":"log_level","correct":"from logdecorator import log_decorator, log_level"}],"quickstart":{"code":"from logdecorator import log_decorator, log_level\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\n\n@log_decorator(log_level.INFO)\ndef my_function(a, b):\n    return a + b\n\nmy_function(1, 2)","lang":"python","description":"Basic usage: decorate a function to log its calls with INFO level."},"warnings":[{"fix":"Use `from logdecorator import log_decorator`.","message":"In version 2.x, the import path changed. `from logdecorator import log_decorator` is correct; `from logdecorator.LogDecorator import log_decorator` no longer works.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Use `@log_decorator(log_level.ERROR, exception_only=True)` instead of `@log_exception`.","message":"The `log_exception` decorator has been replaced by using `@log_decorator(log_level.ERROR, exception_only=True)`.","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Use `log_level.INFO` instead of `'INFO'`.","message":"The `log_level` argument must be the constant from `logdecorator.log_level`, not a string like 'INFO'.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade to v2.x and use `from logdecorator import log_decorator`.","cause":"Using an outdated import path (e.g., from logdecorator.LogDecorator) or an old version.","error":"ImportError: cannot import name 'log_decorator' from 'logdecorator'"},{"fix":"Use `from logdecorator import log_decorator, log_level`.","cause":"Importing only log_decorator without log_level when log_level is referenced.","error":"AttributeError: module 'logdecorator' has no attribute 'log_level'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}