Email Function Logger
A Python decorator to easily log information about a function and send it to your email.
Installation
$ pip install email-function-logger
Email setup
You can set the email information as environment variable on your machine. To do this, add the following line to ~/.bashrc (or ~/.bash_profile depending on your OS).
export EMAIL_ADDRESS="example@domain.com"
This step is optional since you can input the information during the function runtime.
Example of use
from email_function_logger import log_function
@log_function
def mult(x, y):
# Function text output
print(x)
print(y)
# Value returned by function
return x * y
mult(9, 7)
The log sent by email will look like this:
Subject:
Function 'mult' execution log
Body:
Function mult(9, 7) finished its execution.
Start time: Mar 16 18:32:16
Function text output:
9
7
Function returned: 63
End time: Mar 16 18:32:16
Total execution time: 00:00:00
How it works
The decorator receives the function information and send a request to a Flask API hosted on Heroku (available here). This API then sends the email to the address specified in the EMAIL_ADDRESS variable.
Supported versions
- Python 3.2 and above
Author
License
- MIT License
Links
Metadata
Release files for email-function-logger 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| email-function-logger-1.1.tar.gz | 3.1 kB | Without provenance | Details for email-function-logger-1.1.tar.gz |
Release files / email-function-logger-1.1.tar.gz
| Download URL | email-function-logger-1.1.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2518e6c4e8bfc1e52a8d5471266672e1363e7bb2422fac53a23f993df9749b4
|
|
BLAKE2b-256 checksum How to use checksums |
6e7493cd9769c3be3a2428c3a92d0fe2ed73a966391fec0b744a321ecedaf19c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9
|
Security for email-function-logger 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.