对logging进行二次封装, 操作更简单
实例代码
from zlogger import logger
log = logger('test')
log.info('测试')
输出到文件
from zlogger import logger
log = logger('test', write_file=True)
log.info('测试')
指定输出文件的路径
from zlogger import logger
log = logger('test', write_file=True, file_dir='./')
log.info('测试')
单例
可能有多个模块会操作日志模块, 但是你希望只用一个日志对象来避免一个进程产生多个日志文件
from zlogger import logger_singleton
log = logger_singleton('test')
log.info('测试')
参数说明
| 参数名 | 数据类型 | 描述 | 默认值 |
|---|---|---|---|
| name | str | 日志名 | |
| write_stream | bool | 是否输出日志到流(终端) | True |
| write_file | bool | 是否输出日志到文件 | False |
| file_dir | str | 日志文件的目录 | . |
| level | zlogger.LoggerLevel | 日志等级 | LoggerLevel.debug |
| interval | int | 间隔多少天重新创建一个日志文件 | 1 |
| backup_count | int | 保留历史日志文件数量 | 2 |
| append_pid | bool | 是否在日志文件名后附加进程号 | False |
| log_format | string | 日志格式 |
本项目仅供所有人学习交流使用, 禁止用于商业用途
Metadata
Release files for zlogger 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zlogger-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for zlogger-0.1.3-py3-none-any.whl |
Release files / zlogger-0.1.3-py3-none-any.whl
| Download URL | zlogger-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f50471bfa783ff665ba8a7a42337bd5c6b834e8fc83371a17eeadd5a4f4b7a3
|
|
BLAKE2b-256 checksum How to use checksums |
91b924d9277f6af5190bea248cf75e3808a05241753ef7960024fcc94f7eb98c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Security for zlogger 0.1.3
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.