Captures and logs exceptions, optionally printing them to stderr
Project description
Captures and logs exceptions, optionally printing them to stderr.
Tested against Windows 10 / Python 3.10 / Anaconda
pip install pfehler
Capture and log exceptions, optionally printing them to stderr.
Args:
logfile (str, optional): The path to the error log file where the exception details
will be appended. If not provided, no logging to a file will occur.
print_error (bool, optional): If True, the exception details will be printed to stderr.
If False, no output will be printed. Defaults to True.
Example:
from pfehler import pfehler
try:
x = 5 / 0
except Exception:
pfehler(logfile="c:\\errorlogfile.txt", print_error=True)
This function captures an exception's traceback, optionally prints it to stderr, and
appends the error details along with a timestamp to a specified log file. If the log file
does not exist, it will be created. The timestamp format is "YYYY_MM_DD_HH_MM_SS_microseconds".
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
pfehler-0.10.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file pfehler-0.10.tar.gz
.
File metadata
- Download URL: pfehler-0.10.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe48bc644718ece2c263e0f91fae504fff12d5061a4048363f5cd1d41b9d0bc2 |
|
MD5 | ca3699990d5628161d8a8c7460d1fc9b |
|
BLAKE2b-256 | ad1a9b7f071d310d4d076f2cd0b316037e29c527212fdfd59ff47178d654ff7a |
File details
Details for the file pfehler-0.10-py3-none-any.whl
.
File metadata
- Download URL: pfehler-0.10-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da5f41e52cbb3e8c9d6a87904cc970f24594013a5f3317695938649f7f709e90 |
|
MD5 | 0b446638b0621db38cc2fbe9a79368a7 |
|
BLAKE2b-256 | a94d8c0a1d1443629669dc586d97ba8320a4373cd427fdad3d00d86bf178ab16 |