Functions to neatly print debug information to the terminal output, well-suited for multithreaded programs.
Project description
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.
tprint()
tprint(str_msg, ANSI_color=None)
Identical to dprint(), but now prepended with a time.perf_counter() timestamp.
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:
Changelog
0.0.1 (2020-05-13)
First release on PyPI.
1.1.0 (2020-06-04)
Added tprint(…)
1.1.1 (2020-06-06)
Extended README
1.1.2 (2020-06-08)
Code style: black
2.0.0 (2020-07-02)
DvG module filenames changed to lowercase
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dvg-debug-functions-2.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | de024c6e484ce3d044e0760ef34d0308127db96463f3eba662dbeaf998964acc |
|
MD5 | f255c3b40f3943304ffe27812d98e715 |
|
BLAKE2b-256 | 7fe1bb8e457c1f7ed3584d52f55206c2528ee14ea491e716778014318aacd9bf |
Hashes for dvg_debug_functions-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32af95370d629be817a7e4971f60f772541c9712538963dd701fa36316ecdced |
|
MD5 | a5a508b776e6806878b7f7fe8c689769 |
|
BLAKE2b-256 | 3fd304fb7a325c5b53fb552ff2c9939b1442f06aaba125f17e3163113b7d8120 |