Skip to content

Commit

Permalink
Merge pull request #57 from pbzdyl/global-fonts-switch
Browse files Browse the repository at this point in the history
Add possibility to turn off default set of fonts used for exception formatting.
  • Loading branch information
pbzdyl committed Jun 23, 2017
2 parents f1acb20 + 76c2e50 commit 204f26f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/io/aviso/exception.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
[clojure.lang Compiler ExceptionInfo]
[java.util.regex Pattern]))

(def ^:dynamic *fonts*
"ANSI fonts for different elements in the formatted exception report."
(def default-fonts
"A default set of fonts for different elements in the formatted exception report."
{:exception bold-red-font
:reset reset-font
:message italic-font
Expand All @@ -24,6 +24,11 @@
:java-frame white-font
:omitted-frame white-font})

(def ^:dynamic *fonts*
"Current set of fonts used in exception formatting"
(when-not (System/getenv "DISABLE_DEFAULT_PRETTY_FONTS")
default-fonts))

(def ^{:dynamic true
:added "0.1.15"}
*traditional*
Expand Down Expand Up @@ -605,7 +610,9 @@
to configure pretty-printing; however, if `*print-length*` is left as its default (nil), the print length will be set to 10.
This is to ensure that infinite lists do not cause endless output or other exceptions.
The `*fonts*` var contains ANSI definitions for how fonts are displayed; bind it to nil to remove ANSI formatting entirely."
The `*fonts*` var contains ANSI definitions for how fonts are displayed; bind it to nil to remove ANSI formatting entirely.
It can be also initialized to nil instead of the default set of fonts by setting environment variable DISABLE_DEFAULT_PRETTY_FONTS
to any value."
([exception]
(write-exception *out* exception))
([writer exception]
Expand Down

0 comments on commit 204f26f

Please sign in to comment.