-
-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider using more of goog.* Closure library for debugging/logging #34
Comments
@hura Thanks! I'm quite intrigued by the re-frame debug story. With a bit more work, it is going to be excellent. This cycle happens:
At that point, the app pauses, waiting for the next event (user interaction, I/O, etc). Generally, this is the point at which you, the programmer, want to check that everything has just happened correctly. At the moment, using As well, I tend to wrap my entire I put this immediately under the
and then I put a balancing When you do that, you can look in the devtools It is really quite neat. Unfortunately, it is also a bit crap ... because the default output from Plus, I want a way to remove all the clairvoyant code when I compile for production. Without having to remove the wrapping. I want all trace of clairvoyant to disappear when If we can write a better I guess I'm saying that I'm keen on a devtools console based solution, rather than something based on goog.logger. console gives a hierarchical display (via grouping) plus I'd like to eventually see all output for subscriptions show up with a light green background. trace for Components are faint yellow. Event handlers get light blue. It is possible Anyone up for writing a few better clairvoyant tracers, one for each of handlers, subs and components?
To put all this another way ... I'd like to approach debugging as a data visualisation problem. How can clairvoyant-like trace data from steps 1 to 4 be displayed to me, so that I can easily assimilate and process the information. That's why I was talking about slightly different background colours for each of the 4 steps. Small things that help me to process the information. I want high level information, and then the ability to drill down into it (via console's hierarchical display). |
in that case check out this cljs library: I think in your case contributing a different printer to clairvoyant would make the most sense. From a first look, it doesn't look too difficult. |
IMO, logging should have the following "design":
That's already it. The rest of the functionality of a good logger are just convenience. From existing loggers a few patterns emerge: This mostly follows the design of existing (server side) logging framework. On server systems logging usually goes quickly to hard disk (or other IMO on client side all logs should be kept in memory for easy Eg: "Only display Report LogsOnly one small task of a good logger is to actually output the message
Those are called Appenders in timbre. And Reporters in goog closure. Existing librariesI can't really find a great cljs library that does this. I don't think it does buffering however, which means that once a message is out The console isn't bad, but it provides little interaction. I can't filter ConclusionAll this isn't hard to implement. But it's work. It would be super simple API: (ns my-ns.list.item
(:require awesome-logging :refer [logger]))
(def lg (logger)) ;; automatically create a default logger with ns "my-ns.list.item" and no level
;;or:
(def dlg (logger :DEBUG)) ;; change verbosity
;;or:
;; Some of my operations in this file pertain to the parent ns
(def plg (logger "my-ns.list"))
;; Then in the code
(lg :INFO :my-event :and-data)
(lg :DEBUG "added 1+1")
(dlg :db-dump @db)
(plg :INFO "I messed with my-ns.list's stuff" :and-it-liked-it) The logger attaches a time and I can filter/inspect and do whatever I want with I see the need for something flexible like this due to the async nature of OutroWhen you think about, re-frame almost has all this, minus the presentation Sorry for the wall of text, just wanted to brainstorm :) |
I've created such a library: |
Will this change satisfy your logging needs? This change will be a part of v0.4.0 |
Silence is assent, so I'm closing this. If you find any problems, put them in here and we can reopen |
I've notice a little comment in your notes that you're wondering about better logging/debugging mechanism. I'd like to point you to:
https://github.com/google/closure-library/blob/master/closure/goog/demos/debug.html
The demo seems to not work anymore on the offical google closure docs:
http://docs.closure-library.googlecode.com/git/class_goog_debug_FancyWindow.html
So the easiest is to clone google closure repo and just open the debug.html in a browser.
Advantages:
The logging of google closure is actually quite nice & flexible. For instance you can send exceptions automatically to the web server if wanted. Can probably also be easily adjusted to log to airbrake etc.
Feel free to ignore & close this issue.
HTH
The text was updated successfully, but these errors were encountered: