This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-01
Channels
- # announcements (10)
- # aws (1)
- # babashka (19)
- # beginners (104)
- # calva (50)
- # cider (17)
- # cljs-dev (135)
- # cljsrn (56)
- # clojure (240)
- # clojure-dev (4)
- # clojure-europe (19)
- # clojure-nl (2)
- # clojure-uk (7)
- # clojurescript (22)
- # conjure (2)
- # css (1)
- # cursive (10)
- # data-science (1)
- # datomic (60)
- # emacs (2)
- # events (2)
- # exercism (1)
- # figwheel-main (3)
- # fulcro (13)
- # graalvm (5)
- # gratitude (1)
- # inf-clojure (4)
- # introduce-yourself (5)
- # jobs-discuss (21)
- # lsp (36)
- # malli (6)
- # meander (8)
- # missionary (12)
- # off-topic (14)
- # pathom (13)
- # pedestal (10)
- # polylith (42)
- # re-frame (5)
- # reagent (12)
- # reitit (3)
- # releases (8)
- # sci (10)
- # shadow-cljs (37)
- # sql (5)
- # tools-deps (6)
When doing development with io.pedestal.log
, is there a way to customize how the data gets formatted, specifically when it gets printed in the REPL console?
@isak no, but you can do it via your provider For example, I use lockback and this is my logback.xml (thread)
<configuration scan="true"
scanPeriod="5 seconds">
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{"mm:ss.SSS",UTC} %level %msg%n%replace(%caller{2..3}){'Caller\+[0-9]', ''}</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
<logger name="io.pedestal" level="ERROR"/>
<logger name="org.eclipse" level="ERROR"/>
<logger name="io.netty" level="INFO"/>
<logger name="com.amazonaws" level="INFO"/>
<logger name="datomic" level="ERROR"/>
</configuration>
Using this %caller{2..3}
makes #cursive understand that line as a stacktrace line, then it turns it into a clickable linkYou can also parse/pprint values, but you will need to write a custom appender (in the case of logback) It may bring complexities to compile your project.
also, take a look at tap>
and "REBL" things, like #reveal and others libs.
It may solve your problem in another way
@U2J4FRT2T Ok nice, I'm also using logback and cursive. So is the pattern able to call arbitrary code?
Yea for tap> I found that really nice to use with cursive. I just added this and it works great for me:
;; Add puget printer for taps
(require '[puget.printer])
(let [print-taps-fn
(fn [x]
(puget.printer/with-options
{:width 40 :map-coll-separator :line}
(puget.printer/cprint x)))]
(add-tap print-taps-fn))
Ok I may try to write a custom appender that uses puget for the console. Thanks for the help @U2J4FRT2T