-
Notifications
You must be signed in to change notification settings - Fork 2
Simple logger implemented around one-shot session #11
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
Conversation
Codecov Report
@@ Coverage Diff @@
##
8000
master #11 +/- ##
==========================================
+ Coverage 91.31% 92.43% +1.11%
==========================================
Files 7 7
Lines 357 370 +13
Branches 18 17 -1
==========================================
+ Hits 326 342 +16
+ Misses 13 11 -2
+ Partials 18 17 -1
Continue to review full report at Codecov.
|
f579a55
to
4787826
Compare
I found this simple logger quite useful to insert a debug log to each step of threading macros: (def f (pm/make-logger))
(->> (range 10)
f
(filter even?)
f
(map #(* % %))
f
(apply +)) In comparison with: (->> (range 10)
(pm/spy>> :log)
(filter even?)
(pm/spy>> :log)
(map #(* % %))
(pm/spy>> :log)
(apply +)) |
4787826
to
94ffd28
Compare
94ffd28
to
0247eb9
Compare
I'm wondering if a variant of the simple logger could also be useful, such like: (def f (pm/make-multi-logger))
(loop [n 5 sum 0]
(if (= n 0)
sum
(recur (f :n (dec n)) (f :sum (+ sum n)))))
(f) ;=> {:n [4 3 2 1 0] :sum [5 9 12 14 15]} |
0247eb9
8013
to
273c2e3
Compare
This PR explores how useful a simple logger is, such as:
This looks much simpler than the code with existing APIs:
A simple logger is implemented with a one-shot session, and the user doesn't have to reset it every time after peeking the log. This nature would be especially useful when you repeat the cycle of "debug, modify, (re-)eval".