Install
$ pip install plogging
Documentation
Pending... Until then, I will place some implementation code below. Before doing that, though, I
want to make a few notes on the format strings used in the formatter. Firstly, they must use the
bracket formatting style, e.g. "{a}{b!r}{c:<3}". Secondly, by default, colors are only applied
to a given field, meaning for the format string "Log time: {asctime}", only the time would be
given color. This can be changed by using the special enter and exit fields - for example:
"{enter}Log time: {asctime}{exit}", which would cause the entire area to be formatted given the
palette for asctime. Any other normal fields can also be included within the enter/exit
fields, in which case the palette for the first field would be used. Additionally, any field
prefixed with an underscore (_) will not have any formatting applied to it, though the field name
will be reverted to the non-prefixed version (e.g. _asctime -> asctime).
import plogging
import logging
# default formatter that shows a small amount of information (time,
# level name, logger name, message)
log = plogging.setup_new("logger", level=logging.DEBUG, package="test")
# the default formatter itself can be acquired as follows:
plogging.utils.default_formatter()
# you can also setup an existing logger for color formatting
log = logging.getLogger(...)
plogging.setup_existing(log, level=logging.DEBUG)
# custom formatters can also be created; here is an example:
formatter = plogging.Formatter(
fmts=plogging.LevelContainer(
debug="{asctime} {levelname:<8} {module} {message} [{threadname}, {processname}, "
"{somethingelse}]",
default="{asctime} {levelname:<8} {module} {message}"
),
datefmt="%Y-%m-%d %H:%M:%S",
defaults={
"somethingelse": "somethingelse's value"
},
asctime=plogging.Palette(
plogging.LevelContainer(
default="30;1"
)
),
levelname=plogging.Palette(
plogging.LevelContainer(
"32;1",
"34;1",
"33;1",
"31;1",
"41"
)
)
)
log = plogging.setup_new("logger", level=logging.INFO, formatter=formatter)
Metadata
Release files for plogging 0.0.1
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 |
|---|---|---|---|---|
| plogging-0.0.1.tar.gz | 12.2 kB | Without provenance | Details for plogging-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| plogging-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for plogging-0.0.1-py3-none-any.whl |
Total release size: 29.6 kB
Release files / plogging-0.0.1.tar.gz
| Download URL | plogging-0.0.1.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea05da4250cfe224cbea3c6973958eb2326dc514af94beed81209467ef90868c
|
|
BLAKE2b-256 checksum How to use checksums |
98a51b4a00ec98e0e22b4cca6306d28d4e98523389b1dc0cc862f5534fbbf1c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Release files / plogging-0.0.1-py3-none-any.whl
| Download URL | plogging-0.0.1-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02182326fe83d244cf961555d3f955d856f6faac14904de661355738325ce855
|
|
BLAKE2b-256 checksum How to use checksums |
341a530290efacb1cf16bc819b7ff598370e376b3ff215af2e58d30beb2a1872
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Security for plogging 0.0.1
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.