gqylpy-log
English | 中文
gqylpy-logis a secondary encapsulation ofloggingthat allows for more convenient and quick creation of loggers. Using thegqylpy_logmodule, you can rapidly createlogging.Loggerinstances and complete a series of logging configurations, making your code cleaner.
pip3 install gqylpy_log
Using the Built-in Logger
gqylpy_log comes with a built-in logger based on logging.StreamHandler. You can directly call it as follows:
import gqylpy_log as glog
glog.debug(...)
glog.info(...)
glog.warning(...)
glog.error(...)
glog.critical(...)
Its default configuration is as follows:
{
"level": "NOTSET",
"formatter": {
"fmt": "[%(asctime)s] [%(module)s.%(funcName)s.line%(lineno)d] "
"[%(levelname)s] %(message)s",
"datefmt": "%F %T"
},
"handlers": [{"name": "StreamHandler"}]
}
You can adjust the default logger configuration as needed:
glog.default["level"] = "INFO"
However, please note that the default logger is created the first time a logging method is called. To make changes effective, you must modify the configuration before the first call.
Creating a New Logger
The following example demonstrates how to obtain a logger with three handlers:
import gqylpy_log as glog
log: logging.Logger = glog.__init__(
"alpha",
level="DEBUG",
formatter={"fmt": "[%(asctime)s] [%(levelname)s] %(message)s"},
handlers=[
{"name": "StreamHandler"},
{
"name": "FileHandler",
"level": "ERROR",
"filename": "/var/log/alpha/error.log",
"encoding": "UTF-8",
"formatter": {"fmt": "[%(asctime)s] %(message)s", "datefmt": "%c"},
"options": {"onlyRecordCurrentLevel": True}
},
{
"name": "TimedRotatingFileHandler",
"level": "INFO",
"filename": "/var/log/alpha/alpha.log",
"encoding": "UTF-8",
"when": "D",
"interval": 1,
"backupCount": 7
}
]
)
log.info(...)
Alternatively, if you prefer to always call it through the gqylpy_log module, specify the gname parameter:
glog.__init__(..., gname="alpha")
Please note that specifying the gname parameter will override and permanently disable the default logger.
Metadata
Release files for gqylpy-log 2.0.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 | |
|---|---|---|---|---|
| gqylpy_log-2.0.2.tar.gz | 12.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gqylpy_log-2.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.1 kB
Release files / gqylpy_log-2.0.2.tar.gz
| Download URL | gqylpy_log-2.0.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
400733d407cac37efd1118519ef833683a2d585ff3a2a07c4e17bf61d532d309
|
|
BLAKE2b-256 checksum How to use checksums |
d7eb938bf08a4d7680efa80e92bba26bf2bc551a39af5b7659666c9b235672c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Release files / gqylpy_log-2.0.2-py3-none-any.whl
| Download URL | gqylpy_log-2.0.2-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b17f980141d146f5bcc850f3c3d1a293cae2534ff0744c75afa3806cee06a83c
|
|
BLAKE2b-256 checksum How to use checksums |
23ed77ff9dc94b6ecf3e2a7f50b28c163678bc7a00f23f5bb16e6da140c2b950
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Security for gqylpy-log 2.0.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.