Skip to content

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prism

The goal of prism came is to take output from a process and split it up into buckets based on a regular expression, and then letting you view the contents of each bucket individually using a nice TUI.

prism was created primarily to manage the output from turborepo, but it will split output based on a custom regex -- defaulting to one that supports turborepo output -- so it can be used for anything; it can even display its own log output as it is running.

This may all sound a bit vague, so it's probably better explained with some demos:

Running it with a dummy turborepo project asciicast

Running it on its own log output: asciicast

Features

  • Custom regular expression
  • Color support

Installation

$ cargo install prism-rs

Usage

NOTE: This is alpha level software. Use at your own risk.

$ prism -p <prefix_regex> <command>

where prefix_regex is a regex with at least two capture groups. The first capture group will be the prefix, and the second the message.

In the TUI, use j/k to navigate prefixes, and tab to cycle between messages, stderr and unparsable messages.

Examples:

Run yarn dev with the default regex

$ prism yarn dev

Run cat file with a regex that parses lines like DEBUG This is a message

$ prism -p '^([A-Z]*?) (.*)' cat file

Run a command with command line flags:

$ prism "tail -f file"

Use it to split its own log output(NB: if you want to try this, the log files grows very quickly due to the "recursive" nature of doing this)

$ RUST_LOG=debug prism -p '\[.* ([A-Z]+ .*?)\] (.*)' "tail -f log" 2>log

Known issues

  • When used with turborepo, child processes are not terminated reliably
  • The terminal is not always left in a great state when exiting and requires a reset
  • The default regular expression is probably not very good

TODO

  • Scrolling messages
  • tests
  • Configurable scrollback limit
  • Show an indicator for when the process has exited

About

Split noisy log output for clarity

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages