Skip to main content

No project description provided

Project description

tracelogger

Tag your functions to be logged line-by-line with the @tracelogger, optionally add a list of names to print each time

@tracelogger
def second_test_function(x):
    y = x**2
    return y


@tracelogger(names=['b', 'k'])
def first_test_function(a, b):
    c = a + b
    for k in range(5):
        if k % 2 == 0:
            b += k
        else:
            c += k
            second_test_function(c)
    return a, b, c

a, b, c = first_test_function(a=10, b=20)

Will result in:

Entering function: first_test_function
    c = a + b                            locals: b=20
    for k in range(5):                   locals: b=20
        if k % 2 == 0:                   locals: b=20, k=0
            b += k                       locals: b=20, k=0
    for k in range(5):                   locals: b=20, k=0
        if k % 2 == 0:                   locals: b=20, k=1
            c += k                       locals: b=20, k=1
            second_test_function(c)      locals: b=20, k=1

Entering function: second_test_function
    y = x**2                             locals: x=31
    return y                             locals: x=31, y=961
    return y                             locals: x=31, y=961
Returning from: second_test_function() to: first_test_function()

    for k in range(5):                   locals: b=20, k=1
        if k % 2 == 0:                   locals: b=20, k=2
            b += k                       locals: b=20, k=2
    for k in range(5):                   locals: b=22, k=2
        if k % 2 == 0:                   locals: b=22, k=3
            c += k                       locals: b=22, k=3
            second_test_function(c)      locals: b=22, k=3

Entering function: second_test_function
    y = x**2                             locals: x=34
    return y                             locals: x=34, y=1156
    return y                             locals: x=34, y=1156
Returning from: second_test_function() to: first_test_function()

    for k in range(5):                   locals: b=22, k=3
        if k % 2 == 0:                   locals: b=22, k=4
            b += k                       locals: b=22, k=4
    for k in range(5):                   locals: b=26, k=4
    return a, b, c                       locals: b=26, k=4
    return a, b, c                       locals: b=26, k=4
Returning from: first_test_function() to: None

Join the Code Quality for Data Science (CQ4DS) Discord channel for feedback.

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

tracelogger-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

tracelogger-0.1.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file tracelogger-0.1.1.tar.gz.

File metadata

  • Download URL: tracelogger-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for tracelogger-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dbb7a849270aad966151df70b1e0a33d3402d02972a4dd322d72c312ba356300
MD5 71772025e9622c3d1285657054b3664b
BLAKE2b-256 71b5ec8bc9e4e53b3c6b797ad5674f5d13626dcbe9998078d0e264cd6d53c54a

See more details on using hashes here.

File details

Details for the file tracelogger-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tracelogger-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for tracelogger-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 70d771423d84daad25377a2f6f48931f70289d18708ef0ae0bc3db457bc24a66
MD5 c49a93981aaf92f2c2601dfcaa753cb0
BLAKE2b-256 02646418b50eb5b5a80e1d88ab8a42f7401acdfa978e2dc7f6304c84f13d6adb

See more details on using hashes here.

Supported by

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