Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

python library for writing progress texts, echo messages, warnings and errors to standard output

Project description

screenwriter

Python Library for writing progress texts, echo messages, warnings and errors to standard output

Examples:

1 - Default prefix

from screenwriter import Screenwriter

sw = Screenwriter ()
sw.echo ('my output')
Output:
2019-07-26-11:16:04 my output

2 - Date Time parts in prefix

from screenwriter import Screenwriter

sw = Screenwriter ('%Y-%m-%d %H:%M:%S.%f ')
sw.echo ('my output')
Output:
2019-07-26 11:16:04 my output

3 - Error, Warning & Info standard prefixes

from screenwriter import Screenwriter

sw = Screenwriter ()
sw.error ('an error message')
sw.warn  ('a warming message')
sw.info  ('an informational message')
Output:
2019-07-29-11:39:00 ERROR: an error message
2019-07-29-11:39:00 WARN:  a warming message
2019-07-29-11:39:00 INFO:  an informational message

4 - Trimming content length

By default, log strings are trimmed to 120 chars. You can change this setting:

from screenwriter import Screenwriter

sw = Screenwriter ()
sw.set_maxlen (80) #Set maximum length to 80

5 - Dynamically toggele output

You can toggle the output between ON and OFF.

from screenwriter import Screenwriter

sw = Screenwriter ()
sw.echo ('print this line')
sw.set_verbose (False)
sw.echo ('do not print this line')
sw.set_verbose (True)
sw.echo ('print this line')
Output:
2019-10-05-20:09:10 print this line
2019-10-05-20:09:10 print this line

For format options, see http://strftime.org/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for screenwriter, version 1.0.4
Filename, size File type Python version Upload date Hashes
Filename, size screenwriter-1.0.4-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size screenwriter-1.0.4.tar.gz (2.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page