• Stars
    star
    318
  • Rank 131,872 (Top 3 %)
  • Language
    Clojure
  • License
    Eclipse Public Li...
  • Created over 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Light up your Clojure stacktraces

Pyro

Pyro is a library for getting exactly what you need out of Clojure stacktraces. It can be thought of as a "booster pack" for clj-stacktrace, with easy configuration for your project's needs.

example

A Cautionary Note

Pyro is currently alpha software. It may break in unforseen ways and is not guaranteed to be particularly performant. It is advised that Pyro be used in development environments ONLY, and not in production environments.

For the curious, the big thing that slows down speed is having to look up source code and syntax-highlight it. At the moment Pyro ships with a LU cache to help with cases where the same files cause repeated stacktraces. This comes with some memory overhead but ensures that if your program starts blowing up with stacktraces that all traces after the first will be delivered quickly

Installation

To use Pyro in your project, just add the following to the :dependencies key of your project.clj:

[venantius/pyro "0.1.2"]

Usage

The key method in Pyro is pyro.printer/pprint-exception. However, you're unlikely to want to manually trigger it - instead, you'll probably want to use it in place of clojure's default stacktrace invocation methods.

You can sub Pyro's exception printer in for Clojure's default stacktrace invocation methods as follows:

(require '[pyro.printer :as printer])
(printer/swap-stacktrace-engine!)

Configuration

swap-stacktrace-engine! can also be provided with an options map with the following options:

{:show-source true
 :drop-nrepl-elements true
 :hide-clojure-elements true
 :hide-lein-elements true
 :ns-whitelist nil}
:show-source

Boolean. If true, prints syntax-highlighted source code as part of the stacktrace.

:drop-nrepl-elements

Boolean. If true, drops all stackframe elements until a clojure.main/repl/read-eval-print frame.

:hide-clojure-elements

Boolean. If true, removes all stacktrace frames belonging to clojure.core, clojure.lang, etc.

:hide-lein-elements

Boolean. If true, removes all stacktrace frames belonging to leiningen.core.eval, leiningen.test, and leiningen.core.main.

:ns-whitelist

A regex literal. If present, will filter for only those stacktrace frames where the namespace matches one or more of the regular expressions.

Special Thanks

I owe thanks to both the folks at AvisoNovate for inspiring me, and to all of the developers on clj-stacktrace, for providing an excellent scaffolding on which to build.

License

Copyright © 2017 W. David Jarvis

Distributed under the Eclipse Public License, the same as Clojure.

More Repositories

1

ultra

A Leiningen plugin for a superior development environment
Clojure
1,245
star
2

accountant

ClojureScript navigation for single-page applications, made simple.
Clojure
250
star
3

yagni

A Leiningen plugin for finding dead code
Clojure
219
star
4

glojure

The Glojure programming language
Go
172
star
5

vim-cljfmt

A Vim plugin for cljfmt, the Clojure formatting tool.
Vim Script
152
star
6

glow

Syntax highlighting for Clojure source code.
Clojure
101
star
7

vim-eastwood

A Vim plugin for Clojure's Eastwood linter
Vim Script
84
star
8

dotfiles

It's creepy that you want these
Shell
18
star
9

maze

Mazes for Programmers
Go
7
star
10

photon

Experiments in realtime web framework design. Like Meteor, but for Clojure(Script)
Clojure
7
star
11

droplet

Droplet is a Python library for sampling, sketching, and summarizing data from massive data streams.
Python
6
star
12

school

C
2
star
13

takehome

Various puzzles, homework assignments, and interview questions
Python
2
star
14

rethink

A Clojure driver for RethinkDB.
Clojure
1
star
15

yagni-test

Dummy app for testing Yagni
Clojure
1
star
16

spindle

Playing with Node.js and express. Don't take this seriously.
JavaScript
1
star
17

demo

A demo application that shows repeated 404s for a valid worker endpoint using Google App Engine push queues
Go
1
star
18

babel

Chat bots for yo' chat ops.
Clojure
1
star
19

etrade-statement-scraper

A Python script for scraping E*Trade monthly statements for data
Python
1
star
20

shrike

Hosted Code Quality for Clojure -- an abandoned CodeClimate competitor.
CSS
1
star
21

orcs-in-space

Orcs in space!!!
Haskell
1
star
22

darg

Kill the status meeting -- an abandoned IDoneThis competitor.
CSS
1
star