a simple logging tool(support file,email,dingtalk) ,Multithreading and Multi process safe
Project description
Function description
py-log is a simple logging tool(support file,email,dingtalk, wechat) ,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, at_mobiles=('13790000000', '13790000001'))
logger.info('钉钉调试')
# log send wechat
from py_log import get_logger
logger = get_logger('weichat_test', agentid='xxx', at_users='aa|bb', corpid='yyy', corpsecret='zzz')
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-2.5.tar.gz
(20.7 kB
view details)
Built Distribution
py_log-2.5-py3-none-any.whl
(24.7 kB
view details)
File details
Details for the file py-log-2.5.tar.gz
.
File metadata
- Download URL: py-log-2.5.tar.gz
- Upload date:
- Size: 20.7 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.48.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9054848d34798376eb3e8e772b828b23db0a94cbc29fbfcd3ea61d701fb613b |
|
MD5 | 1a0e2925938d273fccb6b54119082702 |
|
BLAKE2b-256 | 50434a5afd3ed1aab69bb6ea53cfc4161febc6bfd2f1edfb61128c63508e30a9 |
File details
Details for the file py_log-2.5-py3-none-any.whl
.
File metadata
- Download URL: py_log-2.5-py3-none-any.whl
- Upload date:
- Size: 24.7 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.48.0 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbaff5b3c6ee684da2f9466ccd966293e77d2f70008af6bbd80dd4ac0b124c9d |
|
MD5 | a53259ba478dc72a164150db2dad3903 |
|
BLAKE2b-256 | b895d260065b558f35588121055d2fe4d49383f3a158e300042e13c4e1052e2b |