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
Import the log function:
from sprawl.loud_log import log
Configure logging however you normally would, for example:
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:
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sprawl-0.1.2.tar.gz.
File metadata
- Download URL: sprawl-0.1.2.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Darwin/17.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a6590b2d0084d6f5bfb301e807b2b5c314d31dd2448835783dcf04966f877a1
|
|
| MD5 |
6c849a2c496f32562431e957ffa05ea7
|
|
| BLAKE2b-256 |
e89768e020dbb238d098e858b7de39f009ca8f8df0ca2e2ba97840f22ecea89e
|
File details
Details for the file sprawl-0.1.2-py3-none-any.whl.
File metadata
- Download URL: sprawl-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.3 Darwin/17.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da3c8f240ccebec5c58d52e771f738d3d7c000e7a9e8ff02745804b2722db327
|
|
| MD5 |
97e852ee44e8fd1867e0ce4da64eb3fd
|
|
| BLAKE2b-256 |
29bc50dde8efb39967ba4a8bfa8455100c739cf1462f862c648ae3d49c026d0c
|