Created
August 30, 2011 17:21
-
-
Save wilkes/1181409 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
;; Really debug.cljs | |
(ns floyd.debug | |
(:require [goog.events :as events] | |
[goog.object :as o] | |
[goog.debug.Console :as Console] | |
[goog.debug.LogManager :as LogManager] | |
[goog.debug.Logger :as Logger] | |
[goog.ui.Component.EventType :as et] | |
[goog.events.EventType :as EventTypes])) | |
(def EVENTS (apply array (concat (o/getValues goog.events.EventType) | |
(o/getValues goog.ui.Component.EventType)))) | |
(.setLevel (goog.debug.LogManager/getRoot) goog.debug.Logger.Level.ALL) | |
(goog.debug.Console/autoInstall) | |
(def logger (goog.debug.LogManager/getRoot)) | |
(defn logset [v o] | |
(js* "window[~{v}] = ~{o};") | |
(js* "console.log(~{o});")) | |
(defn console-log [o] | |
(logset "_last" o)) | |
(defn info [& s] | |
(.info logger (apply str s))) | |
(defn log-events [el] | |
(info el) | |
(events/listen el EVENTS console-log)) | |
(defn debug-console [] | |
(doto (goog.debug.Console.) | |
(.setCapturing true))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment