Skip to main content

A Python package for easy and convenient debugging

Project description

Wraps a function to log its execution, including all args, kwargs, execution result, and errors.

Wrapper does not make any changes that affect the result of code execution or errors.

SUPPORTS: default 'logging.Logger' and 'loguru.logger'

Usage:

import logging
from pretty_debugger import pretty_wrapper

logger = logging.getLogger(__name__)

@pretty_wrapper(logger)
def foo(bar):
    return f"Hello, {bar}"

foo("world")

Corresponding output:

┯
├─► foo(  ---  [NONREPO/test.py:6]
│      bar='world',
│   )
┊   └► 'Hello, world'  [0.0000s]
┷

Output when using nested wrapped functions:

┯
├─► main_task()  ---  [NONREPO/test.py:12]
┊   ├─► get_data(  ---  [NONREPO/test.py:24]
┊   │      arg=42,
┊   │      kwarg='active',
┊   │   )
┊   ┊   └► 420  [0.0000s]
┊   ├─► check_status()  ---  [NONREPO/test.py:29]
┊   ┊   └► None  [0.0000s]
┊   ├─► generate_error()  ---  [NONREPO/test.py:34]
┊   ┊   └X <RuntimeError('Critical Failure')>  [0.0000s]
┊   └X <RuntimeError('Critical Failure')>  [0.0003s]
┷

Param logger: Logger (of default 'logging' or 'loguru' module) with encoding 'utf-8'.

Param debug_level: Custom debug level. If not specified, the logger debug level or WARNING level is used, whichever is higher.

Param round_exec_time: Round the execution time to N after the decimal point

Returns: Wrapped function


Zero-dependency: Package does not require installation of additional libraries. Only default packages are included: inspect, logging, os, and time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pretty_debugger-0.3.1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pretty_debugger-0.3.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pretty_debugger-0.3.1.tar.gz.

File metadata

  • Download URL: pretty_debugger-0.3.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pretty_debugger-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b13e143913ed7dddd87979cfcf791dc61ab2a29ea539ed8b96243b68d5e23535
MD5 e5fe018ffeab32fd97e47c9696e58dcd
BLAKE2b-256 0ccc71004d1bcb4cefb7d50c33509123ab4ebb70b0185bcf5144f1ca48cee478

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretty_debugger-0.3.1.tar.gz:

Publisher: publish.yml on PyCrow/pretty_debugger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pretty_debugger-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pretty_debugger-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7207040abd8ef1db14ebe07b7dfec2bfd65e884ddd41bed0deacf9c79fa81822
MD5 8ddf0233464e842fe6949fff08ba0b84
BLAKE2b-256 95d6bdc806aeb9885cebe01b51b6a4d90a5af95109c9542b4ff4c5c798890a82

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretty_debugger-0.3.1-py3-none-any.whl:

Publisher: publish.yml on PyCrow/pretty_debugger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page