gqylpy-log
二次封装
logging,更方便快捷的创建日志记录器。使用gqylpy_log模块可以快速创建logging.Logger实例并完成一系列的日志配置,使你的代码更简洁。
pip3 install gqylpy_log
使用内置的日志记录器
gqylpy_log 中内置了一个基于 logging.StreamHandler 的日志记录器,你可以直接调用它:
import gqylpy_log as glog
glog.debug(...)
glog.info(...)
glog.warning(...)
glog.error(...)
glog.critical(...)
它的默认配置如下:
level = "NOTSET"
output = "stream"
logfile = "/var/log/{default is your startup filename}.log"
datefmt = "%F %T"
logfmt = "[%(asctime)s] [%(module)s.%(funcName)s.line%(lineno)d] [%(levelname)s] %(message)s"
当然可以修改它:
glog.level = "INFO"
不过需要注意的是,你只有在第一次调用前修改内置的日志记录器配置才会生效,因为在你第一次调用时默认的日志记录器就已经被创建!
创建一个新的日志记录器
import gqylpy_log as glog
glog.__init__(
"alpha",
level ="INFO",
output ="stream,file",
logfmt ="[%(asctime)s] [%(levelname)s] %(message)s",
datefmt="%F %T",
logfile="/var/log/alpha.log",
gname ="alpha"
)
glog.info(...)
或者你希望直接得到日志记录器实例,而不是始终通过 gqylpy_log 模块调用它:
log: logging.Logger = glog.__init__("beta", ...)
log.info(...)
Metadata
Release files for gqylpy-log 1.2
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 |
|---|---|---|---|---|
| gqylpy_log-1.2.tar.gz | 9.4 kB | Without provenance | Details for gqylpy_log-1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gqylpy_log-1.2-py3-none-any.whl | Python 3 | none | any | Details for gqylpy_log-1.2-py3-none-any.whl |
Total release size: 20.0 kB
Release files / gqylpy_log-1.2.tar.gz
| Download URL | gqylpy_log-1.2.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
456a786521324d48333c14ac58f57a1306011d0e05ffff7c4273f3ddd11d2b20
|
|
BLAKE2b-256 checksum How to use checksums |
752663a0edea99733eeed49ae57f9d9e1612f10f189a27abb835b58a7c782653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / gqylpy_log-1.2-py3-none-any.whl
| Download URL | gqylpy_log-1.2-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36104ff0a9fbb9cb39b3bffa6238e3bd9fb4eb36d9b7d050443e0c59646fee26
|
|
BLAKE2b-256 checksum How to use checksums |
9660edfbcbc34d961720fdf77c9134673afe39b12db310a665cf0c5ca4610742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Security for gqylpy-log 1.2
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.