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.2.tar.gz (3.4 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.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vplog-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 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.2.tar.gz
Algorithm Hash digest
SHA256 ffc8b01da604654133ef8eb2e92ae23f66f1d4646644d15fd97393c164c1bc71
MD5 95593de91a3d2d58f3060cbdf84f6a7e
BLAKE2b-256 b9db1c4b2eecb0a4ba2d6df92a6b50df5637636f105de5103b60de0f036b7e33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vplog-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec75a2d8c069ed9561b849ab10b5a4e10448bc16bacb56e6528404e32ad713c9
MD5 761b444fb271c2d32a32503a285c42b1
BLAKE2b-256 b09a71c7b420c2a16791445610181e28a2af2dedc96c1c82165c9f1c5f7aeba0

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