Skip to main content

超级简单的日志模块,导入即用

Project description

ilogger

超级简单的日志模块,导入即用

如何使用它?

>>> pip install ilogger
from ilogger import logger

# 直接使用,默认级别为 INFO
logger.debug('this is debug message')
logger.info('this is info message')
[2019-09-24 19:54:23,544]   INFO: this is info message
from ilogger import logger

# 设置 logger 级别
logger.setLevel(logger.DEBUG)

logger.debug('this is debug message')
logger.info('this is info message')
logger.warning('this is warning message')
logger.warn('this is warning message')
logger.error('this is error message')
logger.critical('this is critical message')
[2019-09-24 19:54:23,544]  DEBUG: this is debug message
[2019-09-24 19:54:23,544]   INFO: this is info message
[2019-09-24 19:54:23,544]WARNING: this is warning message
[2019-09-24 19:54:23,544]WARNING: this is warning message
[2019-09-24 19:54:23,544]  ERROR: this is error message
[2019-09-24 19:54:23,544]CRITICAL: this is critical message
from ilogger import logger

# 设置 logger 格式
logger.setFormatter(fmt='[%(asctime)s]%(levelname)7s[%(filename)s:%(lineno)s]: %(message)s')

logger.debug('this is debug message')
logger.info('this is info message')
[2019-09-24 19:54:23,544]  DEBUG[demo.py:21]: this is debug message
[2019-09-24 19:54:23,544]   INFO[demo.py:22]: this is info message

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

ilogger-0.0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

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