Skip to main content

No project description provided

Project description

Sprawl

A utility package for printing formatted, colorized log messages.

Why?

Sometimes we fall back to good ol' print-driven development ("PDD") when we need to inspect values at runtime. It can be annoying to search through a terminal window filled with other logs to find the one log statement you're looking for. This makes it easy for your log messages to stand out.

Installation

$ pip install sprawl

Usage

Configure logging however you normally would, for example:

Import the log function:

from sprawl.loud_log import log
logging.basicConfig(format='%(asctime)s \n %(message)s', level=logging.INFO)

log a message using the defaults:

log('my log message')

prints:

##################################
 my log message
##################################

Center the log message:

log('my log message', center_message=True)

prints:

##################################
           my log message
##################################

Change the surrounding character:

log('my log message', center_message=True, char_to_surround_with='~')

prints:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           my log message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add some color:

log('my log message', center_message=True, color='yellow')

prints:

Screen Shot 2019-12-11 at 8 55 38 PM

Log the name of the function or module from within which this log() was called

def my_amazing_function():
    log('my log message', center_message=True, print_func_name=True)
    
my_amazing_function()

prints:

log called from my_amazing_function
#################################
           my log message
#################################

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 sprawl, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size sprawl-0.1.1-py3-none-any.whl (2.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sprawl-0.1.1.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page