Skip to main content

简单的控制台彩色日志工具。

Project description

使用教程

import kancylog as log

# 控制是否打印彩色日志,默认是True
# log.disablePrintColor()

# 使用默认的Logger实例
log.debug("debug log")
log.info("info log")
log.warn("warn log")
log.error("error log")
log.success("success log")
log.log("good log", "GOOD")


# 自定义Logger对象
logger = log.Logger(color=True, tag="demo", file="test_{date}.log")
logger.debug("debug log")
logger.info("info log")
logger.warn("warn log")
logger.error("error log")
logger.success("success log")
logger.log("good log", "GOOD")

1)文字效果

2021-11-27 01:17:56.316447 DEBUG 115872 <mainthread> - [log_tests.py::6] : debug log
2021-11-27 01:17:56.316447  INFO 115872 <mainthread> - [log_tests.py::7] : info log
2021-11-27 01:17:56.316447  WARN 115872 <mainthread> - [log_tests.py::8] : warn log
2021-11-27 01:17:56.316447 ERROR 115872 <mainthread> - [log_tests.py::9] : error log
2021-11-27 01:17:56.316447    OK 115872 <mainthread> - [log_tests.py::10] : success log
2021-11-27 01:17:56.316447  GOOD 115872 <mainthread> - [log_tests.py::11] : good log
2021-11-27 01:17:56.316447 DEBUG 115872 <mainthread> - [log_tests.py::16] (demo) : debug log
2021-11-27 01:17:56.316447  INFO 115872 <mainthread> - [log_tests.py::17] (demo) : info log
2021-11-27 01:17:56.316447  WARN 115872 <mainthread> - [log_tests.py::18] (demo) : warn log
2021-11-27 01:17:56.316447 ERROR 115872 <mainthread> - [log_tests.py::19] (demo) : error log
2021-11-27 01:17:56.316447    OK 115872 <mainthread> - [log_tests.py::20] (demo) : success log
2021-11-27 01:17:56.316447  GOOD 115872 <mainthread> - [log_tests.py::21] (demo) : good log

2)图片效果

img.png

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

kancylog-0.0.5.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distributions

kancylog-0.0.5-py3.9.egg (7.0 kB view hashes)

Uploaded Source

kancylog-0.0.5-py2.py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 2 Python 3

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