a simple logging tool(support file,email,dingtalk) ,Multithreading and Multi process safe
Project description
Function description
a simple logging tool(support file,email,dingtalk) ,mutil thread and process safe
Version description
- Supported version: Python 3.0+
Pip installation
pip install py-log
Demo
# log console
from py_log import get_logger
log = get_logger('test')
log.info('123')
# log write file
from py_log import get_logger
logger = get_logger('test1', log_filename='test1.log')
logger.info('aaaa')
logger.debug('bbbb')
logger.warning('cccc')
logger.error('dddd')
# log send dingding
from py_log import get_logger
ding_talk_token = 'xxxxxxxx'
logger = get_logger('ding_talk_test',ding_talk_token=ding_talk_token)
logger.info('钉钉调试')
# log send email
from py_log import LogManager
from py_log.log_manager import MailHandlerConfig
mail_config = MailHandlerConfig()
mail_config.mailhost = ('smtp.sohu.com', 465)
mail_config.fromaddr = 'aaa@sohu.com'
mail_config.toaddrs = 'bbb@qq.com'
mail_config.credentials = ('mail_username', 'mail_password')
logger_mail = LogManager('log_mail_test').get_logger_and_add_handlers(mail_handler_config=mail_config,
is_add_mail_handler=True)
logger_mail.info('test send mail content')
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
py-log-1.8.tar.gz
(20.6 kB
view details)
Built Distribution
py_log-1.8-py3-none-any.whl
(24.4 kB
view details)
File details
Details for the file py-log-1.8.tar.gz
.
File metadata
- Download URL: py-log-1.8.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dea4789b92c6b4def7442035803d91ede4b8816c233ff8a91dccba7fdc6e8edd |
|
MD5 | 4350aa0764f00f838f3ef4f449ad2dde |
|
BLAKE2b-256 | 1602741b18ec47f8d5f6edbdd8a130b1b60f81225fb72e8e3a865a34248046ae |
File details
Details for the file py_log-1.8-py3-none-any.whl
.
File metadata
- Download URL: py_log-1.8-py3-none-any.whl
- Upload date:
- Size: 24.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b82763fb2b5e91157b952e350586189d44c98b37c0e952180ed1000c954b6658 |
|
MD5 | 0b410e270b7f0a5d7a015a17cbba18ae |
|
BLAKE2b-256 | c4c2f41e161fd3bdd75c6472a78f27d4a38bf07021508746cd5621fce8bf2cd8 |