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.9.tar.gz
(20.6 kB
view details)
Built Distribution
py_log-1.9-py3-none-any.whl
(24.4 kB
view details)
File details
Details for the file py-log-1.9.tar.gz
.
File metadata
- Download URL: py-log-1.9.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 | 97120cc01b8068a8c53737ac1409e34410a422efb560bbcf01c6f7dd0131c217 |
|
MD5 | 85d978f1b34c4f01c701841360b7772f |
|
BLAKE2b-256 | c8eb83c20e43d6a0ac5dabdaee4fa22e3177f1f41e3f59079a7a79130408eeac |
File details
Details for the file py_log-1.9-py3-none-any.whl
.
File metadata
- Download URL: py_log-1.9-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 | 9c2b6ee0974a2fc281a0f81808192a5bc88365ff3fe0c434bcb1f290f9969678 |
|
MD5 | 573a55474aed4444a2dd88019d4a87cf |
|
BLAKE2b-256 | 47903a9b85b62d1b1f6a580f83c6d6c59bdb8a2960319a226a47cbd2208c3f55 |