Skip to main content

Redirects print() to timestamped log files.

Project description

vplog 是一个轻量级 Python 库,导入后自动将所有 print() 调用的内容:

输出至终端(保留原有行为)

写入带时间戳的日志文件,文件名格式为 logs/log_YYYYMMDD_HHMMSS.log

无需额外初始化,只需在脚本开头 import vplog 即可。

特性

零配置:导入即生效,无需额外初始化

线程/进程安全:基于 loguru 的 enqueue=True

日志文件自动管理:按启动时刻生成独立日志

兼容性:支持 Python 3.8+

安装

pip install vplog

快速开始

import vplog # 导入即自动重定向 print

print("Hello, vplog!")

终端输出: Hello, vplog!

同时写入 logs/log_20250502_153045.log,内容:

2025-05-02 15:30:45 | Hello, vplog!

配置

日志目录:默认在当前工作目录下的 logs/ 子目录

修改位置:如需定制,可在源码 init.py 中修改 _log_root 路径

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

vplog-0.1.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vplog-0.1.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file vplog-0.1.3.tar.gz.

File metadata

  • Download URL: vplog-0.1.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for vplog-0.1.3.tar.gz
Algorithm Hash digest
SHA256 40691f0507c7c0d17652f623c7be894cf93f71d60868fba8bdfe86b964162862
MD5 cc5ffaea44d00b0392e29c953b81343d
BLAKE2b-256 45a76ecf10c26d72ac51f76efc92e17c4bc0ea249893036e6e4ff8e5f9520e80

See more details on using hashes here.

File details

Details for the file vplog-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: vplog-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for vplog-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e46aaf50998eb7f9ec394c523164af3d7d83ad6918c7dceea16179f6eca7b79b
MD5 76e50c98d3ed8dfe9fc3b67794d4d051
BLAKE2b-256 efb6925f2ca27d24b3129882ff76b65c975a79cc8f65fd41dd76629ddd5ec090

See more details on using hashes here.

Supported by

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