Fork me on GitHub

@seancorfield i downgraded clojure to 1.8.0 and spyscope to 0.1.5. all is well with the world (since i'm not really using spec yet). once i'm done debugging i'll remove spyscope and revert to 1.9.0-RC1. thank you so much!


is there any way to add log or println statements inside a threading macro? looks like it tries to pass the result (`nil`) to the next step. I'd like for the log/print statements to just print the message but otherwise be ignored.


(-> stuff (doto (println)) more-stuff) @clojurian


@clojurian taoensso.timbre/spy can do that for you: (-> stuff spy more-stuff) if you're already using timbre


(but timbre drags in half the world so unless you're already using it, perhaps a sledgehammer to crack a nut?)


and I say that as someone who uses timbre in production


yeah, me too. timbre is .... blunt. but I've found it to be slightly more sane the everything else.


and if you don't have timbre, (def spy #(do (prn %) %)) gets you most of the way there


@bja The big plus of timbre for me is that with plugins it can hijack all logging and filter it through one place. Otherwise, it's really a pain in the butt.


that's exactly my use case. it took me a bit of time to configure correctly, but I can manage all of my logging in the JVM world via timbre and even configure it at runtime easily


We were using bare tools.logging at first and that was super fragile, with log4j, so we backed off to just println for a while, and then switched to timbre, and we're still not happy.


It's like logging is just a horrible problem and timbre is the least bad of many solutions?


@seancorfield, @bja: thank you for the suggestions. i'll look into timbre (it seems.. a lot)


for now, i tried the doto, prn, and spy suggestions but none seem to work. here's a minimal example:

(defn foo0 [x]
  (->> x
       (* 2)))

(defn foo1 [x]
  (->> x
       (doto (println))
       (* 2)))

(defn foo2 [x]
  (->> x
       (spy "doing the thing with the thing")
       (* 2)))


Use -> not ->>


->> inserts the expression at the end of the form. You want the expression inserted as the first argument, not the last.


the function call immediately after the log statement fails with either a cast or arity error.


It's for exploring at the repl and not a logging library though


(require '[hugin.dbg :as dbg])
(defn foo [x]
  (->> x
       (dbg/p< "Doing the thing with the thing")
       (* 2)))
should work.


hmm, dissoc does not work on vectors. what's the simplest way to remove an element from a vector (by index)?


hmmm, i think i broke my repl environment, but i have no idea how to debug it. when refreshing, it throws exceptions on the (:require ...) statements of some files that it cannot find certain modules, where they clearly are defined. after some fierce debugging i was able to get things refreshing, but now my webserver's handlers are suddenly undefined (getting "java.lang.IllegalStateException: Attempting to call unbound fn:" errors) i think something is very wrong somewhere, but i'm unable to pinpoint the issue. sounds like some dangling references / things not getting properly refreshed. any suggestions ?


it's worth noting that lein run and the uberjar created with lein uberjar run fine


so i think there's definitely something wrong with my reloaded flow somewhere


How best to loop over some data and assert it's valid? I tried putting asserts in a doseq but getting strange results: when there is an exception, that iteration is not called.


@danielstockton can you expand a bit on what you're trying to do? Perhaps share some code?


Sure, let me try and come up with a minimum repro


Nevermind, I can't reproduce. I'm basically doing:

(doseq [i [1 2 3 4 5]]
  (println i)
  (assert (< i 4) "Too big!"))
but with something more complicated.


Error is being swallowed somewhere else probably.


Open to hearing about any better patterns for this sort of thing.


Does anybody have experience using Akka via okku? The design looks ok, documentation decent, and it shows up in a "Clojure Programming Cookbook", but the original author admits in a PR comment that it was more of a proof of concept and that he never really used it (as of 2015, at least).