Local development tool for logs printing.
Project description
Simple print
Local development tool for logs printing.
https://github.com/Sobolev5/simple-print
Install
To install run:
pip install simple-print
sprint
Print variables with its names:
master = "yoda" # variable name master
sprint(master)
sprint(master, c="magenta")
sprint(master, c="white", b="on_blue")
sprint(master, c="blue", b="white", a="underline")
sprint(master, c="blue", b="on_white", a="bold", p=True)
master_as_s = sprint(master, s=True) # return as string
master_as_s_with_path = sprint(master, s=True, p=True) # return as string with path to file
ccolor [grey, red, green, yellow, blue, magenta, cyan, white].bbackground [on_grey, on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan].aattribute [bold, dark, underline, blink, reverse, concealed].ppath [True/False] with path to file.llight [True/False] print without fn name and lineno (shortcut lsprint).iindent [1..40].sstring [True/False] return as string.rreturn [True/False] print and return as string.fforce print [True/False] ignore SIMPLE_PRINT_ENABLED=False for docker production logs for example.streamoutput stream [stdout, stderr, null]. stdout by default. null means no print.
Example with indent
Indent print:
def test_indent():
fruits = ["lemon", "orange", "banana"]
sprint(fruits, c="green")
for fruit in fruits:
sprint(fruit, c="yellow", i=4)
lsprint
Light version of sprint.
master = "yoda" # variable name master
lsprint(master)
SprintErr
Minified error traceback.
from simple_print import SprintErr
@patch("logging.info", MagicMock(side_effect=[Exception("Something went wrong")]))
def test_sprint_err(self):
with SprintErr(l=30):
logging.info("")
spprint
Pretty print with indent.
from simple_print import sprrint
spprint(
{"hello": c"world", "lorem": "ipsum"},
i=20,
)
Env
Stop printing on production:
export SIMPLE_PRINT_ENABLED=False
Test
pytest -s
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 simple_print-2.2.6-py3-none-any.whl.
File metadata
- Download URL: simple_print-2.2.6-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3846ab714aea14d14d1f3ab4c54d837090e95b3b517793edf2516d3425d50160
|
|
| MD5 |
2b20c19fa75ba89545f6546b9c0fb697
|
|
| BLAKE2b-256 |
92328f627ff48ea7a224309cf8bc66a782968aefdfcd3f59587645468257d11d
|