Fork me on GitHub
#pedestal
<
2020-06-20
>
polymeris02:06:17

Want to output JSON instead of edn form pedestal.log... is there a way to globally override :io.pedestal.log/formatter?

👍 1
polymeris02:06:38

I've created wrapper macros, but that doesn't seem very nice:

(def formatter json/encode)

(defmacro trace [& keyvals] `(pedestal-log/trace ::pedestal-log/formatter formatter [email protected]))
(defmacro debug [& keyvals] `(pedestal-log/debug ::pedestal-log/formatter formatter [email protected]))
(defmacro info [& keyvals] `(pedestal-log/info ::pedestal-log/formatter formatter [email protected]))
(defmacro warn [& keyvals] `(pedestal-log/warn ::pedestal-log/formatter formatter [email protected]))
(defmacro error [& keyvals] `(pedestal-log/error ::pedestal-log/formatter formatter [email protected]))

souenzzo12:06:07

I'm also looking for this feature. @U0FL657GR a PR with a property -Dio.pedestal.log.formatter=my-custom-json/encoder would be welcome?

ddeaguiar19:06:52

@U2J4FRT2T It’s worth considering. Perhaps open an issue capturing the desire?

souenzzo01:06:50

if you like the idea i can create a PR

ddeaguiar16:06:53

Thanks, will look into it further tomorrow