Skip to main content

# colorize.py

There is at least one [existing tool](http://pygments.org/) to perform automatic syntax highlighting of code and output ANSI escape sequences. Unfortunately, to the best of the author’s knowledge, there is no existing tool for highlighting lines of log files that contain a particular pattern. Vim’s match and 2match are close, but a little kludgy to use.

The purpose of this tool is to colorize lines matching a particular pattern, to make it easier to highlight relevant lines in a log file, when poring over such files with your coworker or manager.

### Usage

Assume we have a file with the following contents.

This is an interesting line with some awesome content. unrelated line unrelated line unrelated line foobar Different topic of interest unrelated line

Then we can run the following commands to see some of effects we want.

colorize.py -h colorize.py -l colorize.py -f ‘This is an interesting line=Blue’ Input.log colorize.py -f ‘This is an interesting line=Blue’ -f ‘Different topic=Red’ Input.log

# Note that we must run less in raw node to see the colors. colorize.py -f ‘This is an interesting line=Blue’ | less -R

Metadata

Release files for colorize.py 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colorize.py 0.5
File Size Uploaded
colorize.py-0.5.tar.gz 3.4 kB Details

Release files / colorize.py-0.5.tar.gz

Download URL colorize.py-0.5.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bf4e6324984a4c521bff6c723328d778411d81e1cc160beb6c861f1d50dc397e
BLAKE2b-256 checksum
How to use checksums
db2d854a379e2fe9ffa424ebdd90188713300116cb44748924987bf73b6cd401
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.9.1

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

This release

0.5 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page