Prints messages to the console
Project description
tealprint
Prints messages to the console
Features
- different verbosity levels:
none, error, warning, info, verbose, debug
- Indent messages easily under a header
- Set color using the colored package
Examples
Indentation
from tealprint import TealConfig, TealLevel, TealPrint
# Using push_indentation()
TealConfig.level = TealLevel.verbose
TealPrint.info("Header")
TealPrint.push_indent(TealLevel.info)
TealPrint.info("More information")
TealPrint.pop_indent()
# Push in header directly
TealPrint.info("Header 2", push_indent=True)
TealPrint.info("Information", push_indent=True)
TealPrint.verbose("Fine grained information")
TealPrint.pop_indent()
TealPrint.info("✅ Done")
# Skips hidden levels
TealPrint.info("Header 3", push_indent=True)
TealPrint.info("Saving all files...")
TealPrint.push_indent(TealLevel.debug)
TealPrint.debug("Saving file X") # Not displayed
TealPrint.info("Couldn't save file Y") # Only indented once, since push_indent(TealLevel.debug) was used
TealPrint.pop_indent()
TealPrint.info("✅ Saved all files")
# Same as above but with TealLevel.debug
TealConfig.level = TealLevel.debug
TealPrint.info("Header 4", push_indent=True)
TealPrint.info("Saving all files...")
TealPrint.push_indent(TealLevel.debug)
TealPrint.debug("Saving file X")
TealPrint.info("Couldn't save file Y") # Will be indented twice this time
TealPrint.pop_indent()
TealPrint.info("✅ Saved all files")
OUTPUT
Header
More information
Header 2
Information
Fine grained information
✅ Done
Header 3
Saving all files...
Couldn't save file Y
✅ Saved all files
Header 4
Saving all files...
Saving file X
Couldn't save file Y
✅ Saved all files
Color
from tealprint import TealPrint
from colored import fg, attr
TealPrint.info("Header", color=attr("bold"), push_indent=True)
TealPrint.info("OK", color=fg("green"))
OUTPUT
Automatic color for errors and warnings
from tealprint import TealPrint
TealPrint.error("Could not open file")
TealPrint.warning("Missing configuration for X")
OUTPUT
Authors
- Matteus Magnusson, senth.wallace@gmail.com
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
tealprint-0.3.0.tar.gz
(19.8 kB
view details)
Built Distribution
File details
Details for the file tealprint-0.3.0.tar.gz
.
File metadata
- Download URL: tealprint-0.3.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f357479950ce5c6e5bbc2349b1c7a906a138186ac2f9dd8dbf1d1627777c66d4 |
|
MD5 | dd59777263b9964127cb675c0f9ad087 |
|
BLAKE2b-256 | 326c5b1eb6d5ebe155d0a5da24fae1438556c56a3b0d901ed4f62feb4532ad8d |
File details
Details for the file tealprint-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: tealprint-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 851731fe3c6d1d3bfe0a383adbc874fec5767ca002b310b5f420eda1f6dcfe84 |
|
MD5 | bcbd05465208148dba78938ec24124bb |
|
BLAKE2b-256 | 7f5ffeb12e2e4245307e38e1a7f406d8133851e8884ffd21979d53544147252a |