C++ Style Colorful output stream for Python with debug level capabilities.
Project description
cstream
C/C++ Style Colorful output stream for Python with level control and thread/process safety options.
Installation
$ pip install cstream
Introduction
Default stderr, stdwar and stdlog instances are directed to standard error output. Note that stdout is also available.
The devnull stram is intended to be used as a context manager in order to supress output directed to stderr and stdout.
Verbosity level control is coherent with the logging module and its constants are made available form importing.
Examples
from cstream import CStream, stderr, stdout, stdlog, stdwar, devnull, WARNING
# Set debug level
CStream.config(level=WARNING)
# Will be printed
stderr << "Error: You are 'redly' wrong"
# Gets printed also
stdwar << "Warning: Just a 'yellowish' warning..."
# Bypassed
stdlog << "DEBUG: Some blue text printed to stderr"
# Suppress all output written to stdout and stderr
with devnull:
print("Bye World?")
Threads and Multiprocessing
from cstream import CStream
# For usage within threads
CStream.config(lock_type=CStream.T_LOCK)
# For multiprocessing
CStream.config(lock_type=CStream.P_LOCK)
# When no lock is needed (Default)
CStream.config(lock_type=None)
Next steps:
- Complete
loggingintegration. - Thread-safe logging.
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
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 cstream-1.0.4.tar.gz.
File metadata
- Download URL: cstream-1.0.4.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10a3f24b1f5dd55cfe899785489d8d8360abe4948499862036567dc06f138140
|
|
| MD5 |
07c53c498300bbb2824325e8772588b4
|
|
| BLAKE2b-256 |
64c2c9bee8d60bec5b027114342d144532a8a3e5f3b8d3fede28888f02a803fd
|
File details
Details for the file cstream-1.0.4-py3-none-any.whl.
File metadata
- Download URL: cstream-1.0.4-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d956c86e931a177d732a7326622c7b3a1fcb4dc524f4bf425cdf03e25e32a4f
|
|
| MD5 |
7eb5d4878148b44479a663ea6ab684b5
|
|
| BLAKE2b-256 |
70007c94707beeae2b0a1fb8d96db11e6466ae77ea7d1dd4d1833c9f4d15be08
|