{"id":32181423,"url":"https://github.com/eigenbahn/icecream-cljc","last_synced_at":"2025-10-21T22:46:11.675Z","repository":{"id":62431789,"uuid":"360538362","full_name":"Eigenbahn/icecream-cljc","owner":"Eigenbahn","description":":icecream: icecream ported to Clojure(Script)","archived":false,"fork":false,"pushed_at":"2023-04-18T15:06:46.000Z","size":25,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-21T22:46:11.317Z","etag":null,"topics":["cljc","clojure-library","clojurescript-library","debug","debugging","inspect","print"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eigenbahn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-22T13:58:02.000Z","updated_at":"2023-10-19T04:19:25.000Z","dependencies_parsed_at":"2022-11-01T20:46:42.838Z","dependency_job_id":"9f85f193-2147-4364-b820-30823a75a529","html_url":"https://github.com/Eigenbahn/icecream-cljc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Eigenbahn/icecream-cljc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eigenbahn%2Ficecream-cljc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eigenbahn%2Ficecream-cljc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eigenbahn%2Ficecream-cljc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eigenbahn%2Ficecream-cljc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eigenbahn","download_url":"https://codeload.github.com/Eigenbahn/icecream-cljc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eigenbahn%2Ficecream-cljc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280348056,"owners_count":26315367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cljc","clojure-library","clojurescript-library","debug","debugging","inspect","print"],"created_at":"2025-10-21T22:46:06.870Z","updated_at":"2025-10-21T22:46:11.669Z","avatar_url":"https://github.com/Eigenbahn.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/gruns/icecream/master/logo.svg\" width=\"220px\" height=\"370px\" alt=\"icecream\"\u003e\n\u003c/h1\u003e\n\n\n## icecream-cljc\n\n[![Clojars Project](https://img.shields.io/clojars/v/com.eigenbahn/icecream.svg)](https://clojars.org/com.eigenbahn/icecream)\n\nPort of Python's [IceCream](https://github.com/gruns/icecream) to Clojure(Script).\n\n\n## Usage\n\n```clojure\n(require '[icecream.icecream :as icecream :refer [ic]])\n\n```\n\nWorks on functions, special forms and macros:\n\n```clojure\n;; function\n(ic (+ 1 1))\n;; \"ic| (+ 1 1): 2\"\n;; =\u003e 2\n\n;; special form\n(ic (if true :yes :no))\n;; \"ic| (if true :yes :no): :yes\"\n;; =\u003e :yes\n\n;; macro\n(ic (when true :yes))\n;; \"ic| (when true :yes): :yes\"\n;; =\u003e :yes\n```\n\nSmartly outputs scalars directly:\n\n```clojure\n(ic 1)\n;; \"ic| 1\"\n;; =\u003e 1\n\n(ic :a)\n;; \"ic| :a\"\n;; =\u003e :a\n\n(ic 'a)\n;; \"ic| 'a\"\n;; =\u003e a\n\n(ic \"hello\")\n;; \"ic| \"hello\"\"\n;; =\u003e \"hello\"\n\n(ic nil)\n;; \"ic| nil\"\n;; =\u003e nil\n\n```\n\n## Configuration\n\nBehavior can be altered through the use of dynamic variables:\n\n```clojure\n;; disable\n(binding [icecream/*enabled* false]\n  (ic 1))\n;; =\u003e 1\n\n;; custom output function\n(require '[taoensso.timbre :as timbre\n           :refer [debug]])\n(binding [icecream/*output-function* #(debug %)\n          ;; NB: you typically want this one as well, explained later\n          icecream/*include-file-location-in-context* false]\n  (ic 1))\n;; 21-07-07 20:01:03 homebase DEBUG [icecream-test.core:131] - ic| 1\n;; =\u003e 1\n\n;; custom prefix - constant\n(binding [icecream/*prefix* \"hello: \"]\n  (ic 1))\n;; \"hello: 1\"\n;; =\u003e 1\n\n;; custom prefix - function\n(require '[tick.alpha.api :as t])\n(binding [icecream/*prefix* #(str (inst-ms (t/now)) \"| \")]\n  (ic 1))\n;; \"1619103609280| 1\"\n;; =\u003e 1\n\n;; systematically include call context\n(binding [icecream/*include-context* true]\n  (test 1))\n;; \"ic| form-init4003934083635828251.clj:6 in icecream-test.core/eval51124- 1\n;; =\u003e 1\n\n;; same but don't include file name / line number\n(binding [icecream/*include-context* true\n          icecream/*include-file-location-in-context* false]\n  (test 1))\n;; \"ic| icecream-test.core/eval51124- 1\n;; =\u003e 1\n\n\n;; smartly include call context (only when inside function calls)\n(binding [icecream/*include-context* :smart]\n  (ic 1))\n;; \"ic| 1\"\n;; =\u003e 1\n\n(defn test [v]\n  (ic v))\n(binding [icecream/*include-context* :smart]\n  (test 1))\n;; \"ic| core.clj:6 in icecream-test.core/test- 1\n;; =\u003e 1\n(binding [icecream/*include-context* false]\n  (test 1))\n;; \"ic| 1\n;; =\u003e 1\n\n;; when calling `ic` w/ no args, `*include-context*` is systematically considered true\n(ic)\n;; \"ic| form-init4003934083635828251.clj:6 in icecream-test.core/eval51125\n;; =\u003e nil\n```\n\n\n## Limitations\n\nIntrospection (when `*include-context*` is `true` or `:smart`) won't work in some cases. Typically in multi-methods or when calling dynamically created lambda functions.\n\n\n## Alternatives\n\n#### tap\n\nYou might want to take a look at the native [tap](https://clojure.org/reference/repl_and_main#_tap) API.\n\nThis [blog post](https://quanttype.net/posts/2018-10-18-how-i-use-tap.html) describe how it can be used for debugging purposes.\n\nIt allows binding several print destinations (akin to iceream's `*output-function*` config). This way you could both log in the REPL and forward say [portal](https://github.com/djblue/portal).\n\nOne notable difference is that `tap\u003e` doesn't return the evaluated form value, but instead a boolean indicating if the action to output succeeded. As such it cannot be inserted as easily as other solutions (inside function calls, threading macros...).\n\nHave also a look at the convenient [pez/taplet](https://github.com/PEZ/taplet) that allows quickly tapping a whole let-binding vector.\n\n\n#### spyscope\n\n[spyscope](https://github.com/dgrnbrg/spyscope) provides several utilities similar to icecream but in the form of reader tags instead of macros.\n\nNotably `#spy/d` (\"details\") is very close in behavior to `ic`, including context resolution.\n\nIt also provides `#spy/t` (\"trace\") that is an aggregated asynchronous version better suited for multi-threaded applications.\n\nIts output function cannot be customized.\n\n\n#### tupelo's spyx\n\n[tupelo](https://github.com/cloojure/tupelo) provides [spyx](https://cljdoc.org/d/tupelo/tupelo/0.9.197/api/tupelo.core#spyx) that behaves very close to `ic` but for which the output function (`println`) can't be redefined.\n\nIt doesn't print caller info (`*include-context*` config). tupelo nethertheless provides [fn-info](https://cljdoc.org/d/tupelo/tupelo/0.9.197/api/tupelo.misc#fn-info) and [fn-info-caller](https://cljdoc.org/d/tupelo/tupelo/0.9.197/api/tupelo.misc#fn-info-caller) (both Clojure only) that is very close in implementation to icecream's `get-call-context`.\n\n\n#### hashp\n\n[hashp](https://github.com/weavejester/hashp) works just like spyscope's `#spy/p` but includes partial context (call location in file).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenbahn%2Ficecream-cljc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feigenbahn%2Ficecream-cljc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feigenbahn%2Ficecream-cljc/lists"}