Skip to content

Commit

Permalink
Modify logging to not override the filter, allowing the default to co…
Browse files Browse the repository at this point in the history
…me from *default-frame-filter*
  • Loading branch information
hlship committed Feb 4, 2015
1 parent 3068144 commit 3d44fda
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/io/aviso/logging.clj
Expand Up @@ -4,15 +4,25 @@
You must [add clojure.tools.logging as an explicit dependency](https://github.com/clojure/tools.logging) of your project."
{:added "0.1.15"}
(:require [clojure.tools.logging :as l]
[io.aviso.repl :as repl]
[io.aviso.exception :as e]
[io.aviso.writer :as writer])
(:import [java.lang.Thread$UncaughtExceptionHandler]))

(defn install-pretty-logging
"Modifies clojure.tools.logging to use pretty exception logging."
([]
(install-pretty-logging repl/standard-frame-filter))
(alter-var-root
#'l/log*
(fn [default-impl]
(fn [logger level throwable message]
(default-impl logger
level
nil
(if throwable
(str message
writer/eol
(e/format-exception throwable))
message))))))
([frame-filter-fn]
(alter-var-root
#'l/log*
Expand Down

0 comments on commit 3d44fda

Please sign in to comment.