Panel rich and jsonl logging.
Project description
▍▞ PJ logging
Simple logging with
rich Panels and
jsonl (or plain .log) files
Basic Usage
set_logger arguments, with types and defaults:
def set_logger(
name: str | None = None,
*,
jsonl_log_file_path: pathlib.Path | str | None = None,
jsonl_log_file_size: int = 100_000,
jsonl_log_backup_count: int = 3,
rich_panel_log: bool = False,
) -> logging.Logger: ...
Example, with rich's Panels only
import pj_logging
logger = pj_logging.set_logger(rich_panel_log=True)
...
logger.info("this is an info log with a rich Panel in the terminal")
Advanced usage
The set_logger function uses the logging RotatingFileHandler
(docs) for the output file
For different needs, the JsonlFormatter can be assigned to a different handler
The PanelHandler can also be imported and added to an existing logger.
With this approach, it's possible to change values of the class' attributes before adding the handler to the logger.
class PanelHandler(logging.Handler):
colors: t.ClassVar[dict[str, str]] = {
"Debug": "blue",
"Info": "green",
"Warning": "yellow",
"Error": "red",
"Critical": "red",
}
fallback_color: str = "white"
title_align: rich.align.AlignMethod = "left"
show_error_names: bool = True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pj_logging-0.1.2.tar.gz.
File metadata
- Download URL: pj_logging-0.1.2.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c359d50688b2134140c7f0a7b524c3a9a9820f6ca31232eef02795dbb7515b3
|
|
| MD5 |
205c87f7b9428f066697bc509a81aa20
|
|
| BLAKE2b-256 |
efc615166db615fd8ab19e00d1173d9e1c4a57476687e9f7d613c4011fecef95
|
Provenance
The following attestation bundles were made for pj_logging-0.1.2.tar.gz:
Publisher:
publish.yml on the-citto/pj-logging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pj_logging-0.1.2.tar.gz -
Subject digest:
4c359d50688b2134140c7f0a7b524c3a9a9820f6ca31232eef02795dbb7515b3 - Sigstore transparency entry: 160274422
- Sigstore integration time:
-
Permalink:
the-citto/pj-logging@cb5f05d309b45e049df070f0de28467d28a90f0f -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/the-citto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb5f05d309b45e049df070f0de28467d28a90f0f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pj_logging-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pj_logging-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
978865171e6cbb2250a67388d16a89ff11141d5889c4167f2072ab4d0e6a19ef
|
|
| MD5 |
55eb490e6ad8f1ad290b1d0cb76cd2ad
|
|
| BLAKE2b-256 |
e7253d5ab5b0b88eb51dbc381097884ada4a8b89081b166068b24cf1901b075c
|
Provenance
The following attestation bundles were made for pj_logging-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on the-citto/pj-logging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pj_logging-0.1.2-py3-none-any.whl -
Subject digest:
978865171e6cbb2250a67388d16a89ff11141d5889c4167f2072ab4d0e6a19ef - Sigstore transparency entry: 160274424
- Sigstore integration time:
-
Permalink:
the-citto/pj-logging@cb5f05d309b45e049df070f0de28467d28a90f0f -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/the-citto
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cb5f05d309b45e049df070f0de28467d28a90f0f -
Trigger Event:
push
-
Statement type: