Log handler to send log via exchange.
Project description
exchange_log_handler
Log handler to send log via exchange
Dependencies
This library used ecederstrand/exchangelib to send exchange mail.
How to install:
pip install exchange_log_handler
Usage:
if __name__ == '__main__':
import logging
import logging.config
logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'stream': 'ext://sys.stdout',
},
'email': {
'level': 'ERROR',
'class': 'exchange_log_handler.ExchangeHandler',
'credentials': ('email_address', 'email_password'),
'subject': lambda r: '{0}-{1}'.format(r.levelname, r.name),
'toaddrs': 'recipient_email_address',
},
},
'loggers': {
'': {
'handlers': [ 'console', 'email' ],
'level': 'DEBUG',
'propagate': True,
},
},
})
logger = logging.getLogger(__name__)
try:
raise ValueError('This is a test exception.')
except Exception as e:
logger.exception(e)
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
File details
Details for the file exchange_log_handler-0.1.0.tar.gz
.
File metadata
- Download URL: exchange_log_handler-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7324c6f02a2a8f292109e142c8b0e985c8778606bf760266a383a3fad6046dc5 |
|
MD5 | 9b60d5fedfc35415540ea78938fb3e57 |
|
BLAKE2b-256 | c8e5cc8b589ffe72a6ab1f31896998d26b6a8e610693252eec522c2f53007509 |
Provenance
File details
Details for the file exchange_log_handler-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: exchange_log_handler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c59ca616fcac46d7281329c6a838c9ae205a81a45dd84d18bfe2e78302e6bcf3 |
|
MD5 | 2764f57b7ce635c67cd3f5df4c0d52a8 |
|
BLAKE2b-256 | 2f295b9fd441c2e9a59d32472a5f526476ab95c22a78484842702984ca184bf4 |