Skip to main content

Functions to neatly print debug information to the terminal output, well-suited for multithreaded programs.

Project description

PyPI version Build Status Coverage Status

DvG_debug_functions

Provides functions for printing debug information to the terminal output.

dprint()

dprint(str_msg, ANSI_color=None) 

'Debug' print a single line to the terminal with optional ANSI color codes. The line will be terminated with a newline character and the terminal output buffer is forced to flush before and after every print. In addition, if PyQt5 is present in the Python environment, then a mutex lock will be obtained and released again for each dprint execution.

There is a lot of overhead using this print statement, but it is particularly well-suited for multithreaded PyQt programs where multiple threads are each printing information to the same terminal. The dprint function ensures that each line sent to the terminal will remain as a continious single line, whereas a regular print statement will likely result in the lines getting mixed up.

print_fancy_traceback()

print_fancy_traceback(err, back=3)

Prints the exception err to the terminal with a traceback that is back deep, using ANSI color codes that mimic the IPython command shell.

Example output:

print_fancy_traceback.png

Changelog

0.0.1 (2020-05-13)

  • First release on PyPI.

1.0.0 (2020-05-14)

  • Updated comments.

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

dvg-debug-functions-1.1.0.tar.gz (17.2 kB view hashes)

Uploaded Source

Built Distribution

dvg_debug_functions-1.1.0-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

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