用于调试输出的高级日志工具
Project description
printPro
一个简单易用的 Python 日志工具,用于调试输出。
功能特点
- 支持多种数据类型的输出(字符串、字典、列表等)
- 可配置的输出格式(时间戳、换行数等)
- 支持临时日志和持久日志
- 多进程安全
- 自动清理过期的临时日志
- 在生产环境中自动禁用(不影响性能)
安装
pip install print-lite
快速开始
from print_lite import printPro
# 基本用法
printPro("Hello, World!")
# 输出字典
data = {"name": "张三", "age": 30}
printPro(data)
# 带时间戳的输出
printPro("带时间戳的消息", show_timestamp=True)
# 持久化日志(不会在程序重启时清除)
printPro("这是一条持久化日志", clear_on_restart=False)
# 输出到指定文件
printPro("输出到特定文件", filename="my_log.txt")
# 输出到指定文件夹
printPro("输出到指定文件夹", folder="subdir/logs")
API 文档
printPro 函数
printPro(
content, # 要输出的内容,可以是任意类型
filename="default.txt", # 输出文件名
clear_on_restart=True, # 是否在程序重启时清空文件
show_timestamp=False, # 是否显示时间戳
line_breaks=1, # 记录间的空行数
folder=None, # 子文件夹路径
forceWrite=True # 是否强制覆盖模式
)
其他实用函数
# 清空所有日志(不包括持久化日志)
from printPro import clear_printpro_logs
clear_printpro_logs()
# 清空所有日志(包括持久化日志)
clear_printpro_logs(include_persistent=True)
许可证
MIT
作者
GDluCk
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
print_lite-0.1.2.tar.gz
(6.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file print_lite-0.1.2.tar.gz.
File metadata
- Download URL: print_lite-0.1.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dac6213e38ac9f25c65810ab3d71a8782c664bee68e8aca0dd2f71bfd8915c1
|
|
| MD5 |
1324860d8be53ebf8a8e957df64f1c67
|
|
| BLAKE2b-256 |
ed4b38304bb8ad3d3bc49c4793423a9af1eb5910fb4341d42e3b3d03cedfc46b
|
File details
Details for the file print_lite-0.1.2-py3-none-any.whl.
File metadata
- Download URL: print_lite-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ec25125af772817bfa801cdcdfbf4a231eb0d6d5f9704130e52a176f3ea168c
|
|
| MD5 |
fac85f0974c893333a259bc09f0683c3
|
|
| BLAKE2b-256 |
4488d9105e4d3f37d20dd64abf1121defbec05f9f6febb80d77c833ab4958f46
|