-
-
Save darwin/6b229ece516861ebfb97f4daa28b9869 to your computer and use it in GitHub Desktop.
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 log [logger level fmt-msg & objs] | |
(let [msg-obj (js/String. fmt-msg)] | |
(aset msg-obj "fmt-objs" objs) | |
(.log logger level msg-obj))) | |
(defn handler [log-record] | |
(let [msg-obj (.getMessage log-record) | |
objs (aget msg-obj "fmt-objs") | |
log-fn (.-log js/console)] | |
(.apply log-fn js/console msg-obj (to-array objs)))) | |
(goog-log/addHandler logger handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment