 
 (ns cider-ci.utils.exception
   (:require 
+    [clj-logging-config.log4j :as logging-config]
     [clojure.stacktrace :as stacktrace]
+    [clojure.tools.logging :as logging]
+    [clojure.string :as string]
     ))
+
+;(logging-config/set-logger! :level :debug)
+;(logging-config/set-logger! :level :info)
+
+
 
 
 (defn expand-to-seq [^Throwable tr]


(defn trace-string-seq [ex]
  (map (fn [e] (with-out-str (stacktrace/print-trace-element e)))
       (.getStackTrace ex)
       ))

;(trace-string-seq (IllegalStateException. "asdfa"))


;(filter-trace-string-seq (trace-string-seq (IllegalStateException. "asdfa")))

(defn stringify [^Throwable tr]
  (string/join ", " (map 
                      (fn [ex]
                        (logging/debug {:ex ex})
                        (str [ (with-out-str (stacktrace/print-throwable ex))
                              (filter-trace-string-seq (trace-string-seq ex))]))
                      (expand-to-seq tr))))
  
;(stringify (IllegalStateException. "A"))
;(stringify (java.sql.SQLException. "SQ"))
