Skip to main content

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, at_mobiles=('13790000000', '13790000001'))
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


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.4.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

py_log-2.4-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file py-log-2.4.tar.gz.

File metadata

  • Download URL: py-log-2.4.tar.gz
  • Upload date:
  • Size: 21.4 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

Hashes for py-log-2.4.tar.gz
Algorithm Hash digest
SHA256 0ff5433bf77c492880ae97d2d605bd0a4b813f1f2367b16ccdee392847de959e
MD5 6a503f48e13704d22847a64f39500b61
BLAKE2b-256 d3d77cef5b0dca00f70d94919d711b370bbf7867503e4dc67320089acbc261ad

See more details on using hashes here.

File details

Details for the file py_log-2.4-py3-none-any.whl.

File metadata

  • Download URL: py_log-2.4-py3-none-any.whl
  • Upload date:
  • Size: 25.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.48.0 CPython/3.7.1

File hashes

Hashes for py_log-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7d0ee0aaa0ad6537fa7da7a78f19f71a0e98ab039f2287711f67f62361f59ab7
MD5 0928a7011afcce28b05dd65f3082a962
BLAKE2b-256 edbba9d53109ed7fea81cf060ccff5d32b6c52324162f18ff2e52a2a8241c4bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page