{"id":1012,"date":"2015-08-19T13:48:46","date_gmt":"2015-08-19T13:48:46","guid":{"rendered":"http:\/\/sdi.thoughtstorms.info\/?p=1012"},"modified":"2015-08-19T13:48:46","modified_gmt":"2015-08-19T13:48:46","slug":"colourize-clojure-errors","status":"publish","type":"post","link":"https:\/\/sdi.thoughtstorms.info\/?p=1012","title":{"rendered":"Colourize Clojure Errors"},"content":{"rendered":"<p>Clojure is a wonderful language. The more I use it, the more I like it.<br \/>\nBut the default error reporting is catastrophically bad, forcing you to look through screensful of Java stack-trace for the needle of a bit of code that&#8217;s actually yours.<br \/>\nI&#8217;m sure there are better solutions, but today I just hacked a very quick and dirty python program to filter this result, highlighting the lines that I care about.<\/p>\n<pre><code>\n#!\/usr\/bin\/python\nimport sys\np = sys.argv[1]\nfor line in sys.stdin :\n    if p in line :\n        print '\u000033[92m' + line + '\u000033[0m',\n    else :\n        print line,\n<\/code><\/pre>\n<p>I made this code in an executable file called &#8220;colourit&#8221; in my bin directory. Now I can do this :<br \/>\n<code><br \/>\nlein test |& colourit patterning<br \/>\n<\/code><br \/>\nto, for example, highlight lines containing the word &#8220;patterning&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Clojure is a wonderful language. The more I use it, the more I like it. But the default error reporting is catastrophically bad, forcing you to look through screensful of Java stack-trace for the needle of a bit of code that&#8217;s actually yours. I&#8217;m sure there are better solutions, but today I just hacked a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[67,365,418],"class_list":["post-1012","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-clojurescript","tag-python","tag-small-tools"],"_links":{"self":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1012"}],"version-history":[{"count":0,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=\/wp\/v2\/posts\/1012\/revisions"}],"wp:attachment":[{"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sdi.thoughtstorms.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}