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) ,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-2.1.tar.gz
(20.8 kB
view details)
Built Distribution
py_log-2.1-py3-none-any.whl
(24.8 kB
view details)
File details
Details for the file py-log-2.1.tar.gz
.
File metadata
- Download URL: py-log-2.1.tar.gz
- Upload date:
- Size: 20.8 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 | 8e562f1de2742a116c31fe3f278b9834d75de44c7f2fc05275140940dcae7e7d |
|
MD5 | 2ac62f1055db2ba49469cc7296746040 |
|
BLAKE2b-256 | 3a3e0dfa60fe4e96fb38dde6c6c06947a9b0a79ee7c1e5229f46edf3c6cd242f |
File details
Details for the file py_log-2.1-py3-none-any.whl
.
File metadata
- Download URL: py_log-2.1-py3-none-any.whl
- Upload date:
- Size: 24.8 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 | 1dc600e9c65d348d15f73299a7a6fcd9ac89f987c5937657f23048a1bc3b3e46 |
|
MD5 | 2ea78207c8fd1fcb47e05e665481c447 |
|
BLAKE2b-256 | aee37a355b31297d37571e675d6212668fcd5ea0585be2c619223a943fdadeab |