Skip to main content

日志系统。可在控制台输出一定格式的、可选颜色的内容,并支持写入指定的日志文件。

Project description

CheeseLog

介绍

一款完全动态的日志系统,它有以下特点:

  1. 多种的消息等级,可自定义添加新的等级。在打印与日志写入可以使用权重、指定消息或指定模块内的消息进行过滤,实现个性化的消息输出。

  2. 支持控制台样式打印,有完善的样式体系可以直接使用,自定义的消息模版可以实现个性化的消息输出,在未有打印环境的情况下停止打印节省资源。

  3. 支持日志文件记录,支持动态修改输出文件,可自由开启关闭。

  4. 可以输出自定义格式的进度条,这对于一些下载或加载的控制台显示非常有帮助。

目前仍处于开发阶段,各种功能并不保证以后的支持。

安装

系统要求:Linux。

Python要求:目前仅保证支持3.11及以上的python。

pip install CheeseLog

示例

基本用法

打印各种类型的Hello World,更多的内置方法请查看Logger

from CheeseLog import logger

logger.debug('Hello World')
logger.info('Hello World')
logger.warning('Hello World')
logger.danger('Hello World')
logger.error('Hello World')

样式打印

更多样式请查看Style

from CheeseLog import logger

# 如果没有日志文件输出,可以在message直接使用样式
logger.debug('<green>Hello World</green>')

# 因为message会被记录到日志文件中
logger.debug('Hello World', '<green>Hello World</green>')

# 如果内容有'<'和'>'的组合,请对部分内容进行加密
logger.debug(logger.encode('<p>Hello World</p>'))

日志输出

from CheeseLog import logger

logger.filePath = './myLog.log'

logger.debug('Hello World')
# 中途修改输出日志是可以的
logger.filePath = './yourLog.log'
logger.debug('Hello World')

logger.destroy() # 使用输出日志功能后请使用该函数摧毁

消息过滤

更多消息过滤信息请看Logger

更多消息等级信息请看Level

from CheeseLog import logger

logger.filePath = './myLog.log'
logger.weightFilter = 20 # 权重过滤,优先级最高
logger.levelFilter.add('DANGER') # 指定消息等级过滤,优先级其次
logger.moduleFilter['Xxx'] = 100 # 指定模块过滤,优先级最后
...

更多...

1. Style

2. Level

3. Logger

4. Progress Bar

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

cheeselog-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

cheeselog-1.0.1-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cheeselog-1.0.1.tar.gz.

File metadata

  • Download URL: cheeselog-1.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cheeselog-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5e81096a9e80462d60650276580d23630d063014ce4be9652dc757d4bc634149
MD5 728fb6778b0c6d0bdc5f8baf0eebaea6
BLAKE2b-256 b49bcc9c3ba2bbf7d3ffa8cfe28b5a6f02193aa74b26cc208bb90622d99b393e

See more details on using hashes here.

File details

Details for the file cheeselog-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cheeselog-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cheeselog-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8d7de127bd7372098afa0067e9158653e3ed7ef269758e45ad59bf5962deea53
MD5 427c8268bf04c8bab8c60c71992fb625
BLAKE2b-256 df4b29cd2cc62510d07882befd6c25d2d44bd15a7dd0160ef1ff1262918b4bdf

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