Skip to main content

Prism — colourful logs

A command line log colouriser utility.

Installation

From Python package index (Pypi):

(sudo) pip install logprism

Optionally with watchdog:

(sudo) pip install logprism[watchdog]

or from Github:

(sudo) pip install watchdog # optional

git clone https://github.com/peterhil/prism.git

cd prism

(sudo) python setyp.py install

Dependencies

All dependencies can be installed with pip, usually by:

pip install some-package

Required (automatically handled by pip):

  • ordereddict (if using Python 2.6)

Optional (install manually with pip):

  • watchdog (watch files and directories with the -w option. Recommended for Python 2.x only – doesn’t work with Python 3)

Developers only:

  • pytest (test framework)

  • tox (continuous integration)

Usage examples

Colourise stdin:

tail -f /opt/local/var/log/couchdb/couch.log | prism

Grep some logs for messages with levels:

prism -g /var/log/*.log

Combine with grep command to find just specific levels:

grep -iE ‘(warn|error)’ /var/log/*.log | prism -g

Match multiple log levels per line:

prism -m /var/log/apache2/vhost*log

prism -m <(echo “Dribble me a debug or info lest I notice no create nor alter nor drop of your critical tables.”)

Watch for a whole directory of logs for changes (and new files):

prism -m -w /opt/local/var/log/nginx/

Some programs output normally to stderr, grab that output for prism:

python run.py 2>&1 | prism

Test

Run unit tests:

python setup.py test

Run continuous integration with tox (from an activated virtualenv, use tox -r to recreate CI envs):

tox

Todo

  • Show some tail lines when using -w: Make a line cache (count total lines with wc -l) from the end of the file using some blocksize.

    1. Can be done with readlines() first. Then seek and read blocksize bytes from len(file)-blocksize and update cache.

    2. Later enable ncurses scrolling for earlier lines?

    3. Show n lines by default (a screenful / filecount?)

https://img.shields.io/pypi/v/logprism.svg https://img.shields.io/pypi/dm/logprism.svg https://img.shields.io/pypi/l/logprism.svg

Metadata

Release files for logprism 0.2.0

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

Source distribution (sdist)

Source distribution for logprism 0.2.0
File Size Uploaded Provenance Actions
logprism-0.2.0.tar.gz 9.2 kB Without provenance Details for logprism-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logprism 0.2.0
File Interpreter ABI Platform Actions
logprism-0.2.0-py3-none-any.whl Python 3 none any Details for logprism-0.2.0-py3-none-any.whl

Total release size: 20.2 kB

Release files / logprism-0.2.0.tar.gz

Download URL logprism-0.2.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1a6951cb16e7b3d5d6b5517a23d4895d101b7b469a277f7f7b25cc497d770c84
BLAKE2b-256 checksum
How to use checksums
596663389445372bd0e5132409884da0364d667885d1e41eb24c3d59cf0f8e39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Release files / logprism-0.2.0-py3-none-any.whl

Download URL logprism-0.2.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5fbe7db2892de0b59fb43a2bdb6a4077270a8d0802d3eb18d4f6cfc50fab7f0
BLAKE2b-256 checksum
How to use checksums
6064e653e0cb16b816d7e86d5ac27386939c97b1c64549fe320dbcfb2b1f15a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.14

Security for logprism 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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