Created
April 13, 2017 23:40
-
-
Save colliderwriter/352eedbb02159ab6ff3fb84c5d676835 to your computer and use it in GitHub Desktop.
Clojure pretty printer hack to redact secrets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn pp-secrets [obj] | |
(let [orig-dispatch pprint/*print-pprint-dispatch*] | |
(pprint/with-pprint-dispatch | |
(fn [o] | |
(if (:secret (meta o)) | |
(do (print "*redacted*") | |
(pprint/pprint-newline :fill) | |
) | |
(orig-dispatch o))) | |
(pprint/pprint obj)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment