Simple log formatters for colored output.
Project description
LogColor
When making command line interfaces, it's often useful to colorize the output to emphasize salient pieces of information or otherwise enhance the user experience. Unfortunately it's quite cumbersome to add colorized outputs to Python log messages.
ColorFormatter
The ColorFormatter is a logging formatter that parses your log messages and adds color codes to the log messages.
ColorStripper
The ColorStripper formatter is the inverse of the ColorFormatter. It strips the color information from your messages so that you can log to a file without it being full of color codes.
Installation
I'm on pypi!
$ pip install log_color
Features
- Simple to use
- No external dependencies
- Compatibility with Python 3.7+, PyPy
- Fast! Compiled binaries are available for some systems!
http://no-color.org/
LogColor honors the NO_COLOR environment variable.
Developer Setup
This project uses uv for dependency management, command running, etc... install it:
$ curl -LsSf https://astral.sh/uv/install.sh | sh
Makefile
If you're on Linux or OSX, there is a Makefile with a number of helpful targets:
make check-typesRunmypystatic code analysis toolsmake format-codeRuns the ruff code formattermake check-codeValidates no code formatting errors or import sorting errors (check only, makes no changes)make wheelBuild Python.whlfile for distributionmake testRun the unittestsmake docsBuild the documentationmake freezeList all packages (and their version number) installed in the virtual environmentmake shellLaunch an interactive Python shell in the virtual environment contextmake cleanRemove any files that aren't part of the repo (build artifacts, test reports, etc...)make git-cleanRuns the gitfscktool, prunes the reflog, etc...
TIP: If you want to force a target to be re-evaluated (i.e. make env) run make with the -B flag to force
it to evaluate.
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 log_color-2.1.0.tar.gz.
File metadata
- Download URL: log_color-2.1.0.tar.gz
- Upload date:
- Size: 163.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6856fbcb6b1f8c91ae1049eaa7e28775569b4fcd228348d552845389dd36e8e
|
|
| MD5 |
0ebeba7caa1b800927c1d7634a657388
|
|
| BLAKE2b-256 |
dc0f839813e28281d221ccf41d3eb550442eebb5fefd2e7498e271853b692229
|
File details
Details for the file log_color-2.1.0-py3-none-any.whl.
File metadata
- Download URL: log_color-2.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f63bc1d38bbfe063b269d92a95cb53fb15cb7f43d1b85668bc6a6d1940b7015a
|
|
| MD5 |
ccca757d895a156f49c27fcfe21c948f
|
|
| BLAKE2b-256 |
329538a8efda2c9fcb42a0fc8af91bc931ab256a375f0502cb2c7b84a2470a45
|