deepfos-loguru-corotate
基于 loguru 的集中日志轮转与多进程协同 reopen:由单一进程(例如 Gunicorn master)按与 loguru FileSink 一致的规则执行 rename 轮转,再通过向同一进程组广播 SIGWINCH,使 worker / 子进程等在保留原有 SIGWINCH 处理的前提下链式执行 loguru 的 remove + configure,从而避免仍持有旧 inode 继续写归档前的文件。
功能概要
- 集中轮转:轮询
should_rotate,到期则rename当前日志、重建目标文件、在 rotator 进程上执行本地 reopen,再os.killpg(..., SIGWINCH)通知同作业进程组。 - SIGWINCH 链:
ensure_reopen_inited安装处理器时保存原有处理函数;信号到达时先调用原处理(如框架自带的 reopen),再执行已登记的 loguru reopen。 - fork 后状态:可在 worker
post_worker_init等场景调用reset_reopen_state_after_fork,避免子进程继承不应共享的状态。 - 压缩与保留:轮转生成的归档路径可在延迟后执行与 loguru 策略对齐的压缩与 retention(实现依赖 loguru 内部 API)。
安装
pip install deepfos-loguru-corotate
或从源码
pip install .
Metadata
Release files for deepfos-loguru-corotate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| deepfos_loguru_corotate-0.1.0.tar.gz | 8.7 kB | Without provenance | Details for deepfos_loguru_corotate-0.1.0.tar.gz |
Release files / deepfos_loguru_corotate-0.1.0.tar.gz
| Download URL | deepfos_loguru_corotate-0.1.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fda2f53c7cd033f96620fa2c2d9e082957e20e09eccb3a7e256b752e1395cbd9
|
|
BLAKE2b-256 checksum How to use checksums |
9b5103ca20e11a87ec4a6c4bdd7bdbe1942e86443c9e8bc003a6ebeeb0685d33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.3
|
Security for deepfos-loguru-corotate 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.