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
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-1.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c7583a310a49792bc7dca05d0c2b1d7f7573372d3c39a12fec850b54c37d4ff |
|
MD5 | 950f2a2bd4b2d6cd0df4da1046fd33c4 |
|
BLAKE2b-256 | 4b217dd4282fbbdd5fa72a3eaabbc2a7dc9e39f08d4a3612fd7b8b221c4fded4 |
Hashes for dvg_debug_functions-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c9147516f47a462fcdddf21321683213ad44e4fa0ee69b43dba718ca6780f6b |
|
MD5 | 33d64b8b39328b4a7de291597736d1a3 |
|
BLAKE2b-256 | 2334db21eefcd064680bce5d0488620cfb4ad3f86ffe43f4f4edaeaa0639ca86 |