Skip to main content

Package for colored organized verbose printing in python.

Project description

Pretty Verbose

PyPI version License Test Python Package Upload Python Package

Package for beautiful verbose printing in python.

Installation

The package is available in the Python Package Index (PyPi).

python3 -m pip install pretty_verbose

Examples

To use the verbose output, create a VerboseMessages object.

from pretty_verbose import VerboseMessages

messages = VerboseMessages(
    level=3,
    scope="main",
    filename="messages.log"
)

The level indicates which messages will be printed.

  • -1: Just Debug.
  • 0: Debug and Errors.
  • 1: Debug, Errors and Warnings.
  • 2: Debug, Errors Warnings and Success.
  • 3: Debug, Errors Warnings, Success and Info.

The scope works to use the VerboseMessages in several instance and differentiate where the message is coming from. Finally the filename will store all the messages printed in the terminal.

The following messages can be printed.

import time

messages.debug("This is a debug message.")
messages.error("This is an error message.")
messages.warning("This is a warning message.")
messages.success("This is a success message.")
messages.info("This is an info message.")

for i in range(100):
    if i % 10 == 0:
        messages.for_message("This is an info message inside a for loop.")
    messages.progress("This is a progress message.", (i+1))
    time.sleep(0.1)

The result will be the following.

[28/08/2022 14:12:09] DEBUG [main]: This is an debug message.
[28/08/2022 14:12:09] ERROR [main]: This is an error message.
[28/08/2022 14:12:09] WARNING [main]: This is a warning message.
[28/08/2022 14:12:09] SUCCESS [main]: This is a success message.
[28/08/2022 14:14:06] SUCCESS [main]: This is a success message.
[28/08/2022 14:12:10] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:11] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:13] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:14] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:15] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:16] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:17] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:18] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:19] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:12:20] INFO [main] -- This is an info message inside a for loop.
[28/08/2022 14:14:19] INFO [main] -- This is a progress message.: [100.00%]

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

pretty_verbose-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

pretty_verbose-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file pretty_verbose-0.1.0.tar.gz.

File metadata

  • Download URL: pretty_verbose-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pretty_verbose-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dceb2fb153610c08992358121b3d4693a3f0721b78673684dbb3adb41a9c127d
MD5 dba7e6f27b943ff03c6d56ec38472eda
BLAKE2b-256 d334a40d24770a684e3debd555dae16617e84d9454e3ff8acd26ca76d7184c70

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretty_verbose-0.1.0.tar.gz:

Publisher: python-publish.yml on ccmorenos/pretty_verbose

Attestations:

File details

Details for the file pretty_verbose-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pretty_verbose-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea6f628f24a00d959f46b5944a80b80cf81fab0eb011d433e521078730039388
MD5 dec57e3a90862b1c9961a06b870c176b
BLAKE2b-256 77d7e6cfd1f2a2a877a21b7a29af4698ef5626e8c34bf892e3def7eb9dd9ac8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretty_verbose-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on ccmorenos/pretty_verbose

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page