Skip to main content

A lightweight library for clean console output

Project description

sane-out for Python

A lightweight library for clean console output

Install

With pip:

pip install sane-out

With Poetry:

poetry add sane-out

With pipenv:

pipenv install sane-out

Use

Default behaviour

from sane_out import out

out("This is an info message")
out.info("This is an info message too")

out.debug("This is a debug message. It won't be printed without 'verbose=True'")
out.verbose = True
out.debug("Now this debug message will be printed")

out.warning("Warning! This is a message that will be printed to stderr")

out.error("Your code will print an error message crash with code -1!")
out.error("You can crash your program with a custom code", 42)

out.calm_error("You can also print an error message without crashing")

Custom instance

from sane_out import _SanePrinter

# Setup your output with constructor params

talkative = _SanePrinter(verbose=True, colour=True)
boring = _SanePrinter(verbose=False, colour=False)

talkative.debug("Shhh... This is a debug message")
boring.debug("I will not print this")
boring.warning("And this won't have amy colour")

License

MIT © Nikita Karamov

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

sane-out-0.2.1.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

sane_out-0.2.1-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

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