Fork me on GitHub
#clojure
<
2016-06-26
>
creese00:06:36

What's the best way to format exceptions as JSON?

creese00:06:29

I've been experimenting with the logstash logback encoder. Messages come out right, but uncaught exceptions span multiple lines.

creese00:06:47

Are there best practices for structure logging from clojure?

Alex Miller (Clojure team)00:06:17

Have you looked at using Throwable->map in core?

leo.ribeiro00:06:49

hey guys, should I use clojure to webapps? (I’m coming from java - springboot and dropwizard background)… I’m loving clojure, but had read some places that clojure fits best for multi-threaded development…

leo.ribeiro00:06:56

@alexmiller: hey my friend! pleasure to see you here. does your book (clj applied) has database examples (connection pool, transactions handle etc)?

creese00:06:54

@alexmiller: I don't want to throw the exception. I want the logger to log uncaught exceptions on one line

creese00:06:17

preferably as json

Alex Miller (Clojure team)00:06:53

@leo.ribeiro: the most common thing people do with Clojure is to write web apps

Alex Miller (Clojure team)00:06:42

Clojure applied does not have anything about databases, sorry

Alex Miller (Clojure team)00:06:15

@creese: I'm just saying that that function can convert an exception to data, which is easily jsonified

akiva00:06:37

@leo.ribeiro, the new book from Wrox, Professional Clojure, covers Datomic to some depth. I haven’t read it myself but by the table of contents, it looks fairly comprehensive as a start.

sage03:06:52

is it currently possible to make an fdef spec where the :args are a tuple? when I instrument the implementation I get an exception about the args.

sage03:06:50

Evaluating (tuple-arg-fn [0 0]) leads to the following exception:

hiredman03:06:27

that isn't how `:args' works

hiredman03:06:20

that ':args' spec would work for function that takes two args that are numbers, not a function that takes a pair of numbers

tap04:06:45

@jmitchell: Maybe this is what you want?

(s/fdef tuple-arg-fn
  :args (s/cat :tuple (s/tuple int? int?))
  :ret int?)

gfredericks13:06:20

wolfcore: macros haven't changed much, with the exception of clojure.spec

gfredericks13:06:50

which just adds new techniques for processing arguments and reporting errors

gfredericks13:06:56

I think the book is still a good starting point

sage15:06:18

thanks @tap and @hiredman. I follow what's going on now.

Ivan Fedorov17:06:04

Anyone with compiled jar knowledge? Is there a way in Clojure to discover non-required namespaces (not required in any namespace), when it is in compiled jar?

Alex Miller (Clojure team)18:06:51

I don't know of a thing that tells you that

Alex Miller (Clojure team)18:06:37

tools.namespace I believe has tools to help you construct a graph of namespaces so it could get you some of the way there

Ivan Fedorov18:06:46

Looks like it works only with source files

sage19:06:37

does the s/fdef for declare described in https://clojure.org/guides/spec#_macros allow valid input? i get an exception when i instrument it and try to run (declare x)

tom23:06:54

Do any of the clojure time libraries out there handle cron expressions and can provide a sequence of date objects or date strings in a range? Something like '* */30 * * *' => ('2016-05-05 00:00:00' '2016-05-05 00:30:00' ....)

Alex Miller (Clojure team)23:06:58

@jmitchell: I think that example has fallen out of working due to changes in instrument. Macros take 2 extra implicit args and instrument is no longer working properly with them. However you should no longer call instrument on macros anyways as macros are always checked during macroexpansion