Crates.io | prism-rs |
lib.rs | prism-rs |
version | 0.1.0 |
source | src |
created_at | 2022-10-09 15:37:17.971464 |
updated_at | 2022-10-09 15:37:17.971464 |
description | prism is a tool for splitting up noisy log output into groups based on a regular expression. Primarily written to work alongside turborepo(https://turborepo.org/), but it supports a parsing log lines based on a custom regular expression. |
homepage | |
repository | https://github.com/saevarb/prism |
max_upload_size | |
id | 684064 |
size | 36,397 |
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
Running it on its own log output:
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
turborepo
, child processes are not terminated reliablyreset