Fork me on GitHub
#pedestal
<
2018-02-28
>
souenzzo18:02:00

Can I get from context map the name of the "actual" interceptor?

andrzejsliwa18:02:27

any idea how to override logback in tests?

hlship00:03:50

If logback finds a logback-test.xml on the classpath, it uses that instead of logback.xml. So put a copy in dev-resources. I start with this:

<configuration scan="true" scanPeriod="1 seconds">

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%-5level %logger - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="warn">
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>

andrzejsliwa19:02:11

{:profiles {:test {:jvm-opts ["-Dlogback.configurationFile=test-logback.xml"]}} just switched to different config

dadair22:02:08

@souenzzo yes, see the print out of the context in the following example:

dev> (require '[io.pedestal.interceptor.chain :as chain])
nil
dev> (def a {:name :a :enter (fn [ctx] (clojure.pprint/pprint ctx) ctx)})
#'dev/a
dev> (def b {:name :b :enter identity})
#'dev/b
dev> (chain/execute (chain/enqueue {} [b a]))
#:io.pedestal.interceptor.chain{:queue <-()-<,
                                :execution-id 114,
                                :stack
                                ({:name :a,
                                  :enter #function[dev/fn--47949]}
                                 {:name :b,
                                  :enter
                                  #function[clojure.core/identity]})}
{}
dev> (chain/execute (chain/enqueue {} [a b]))
#:io.pedestal.interceptor.chain{:queue
                                <-({:name :b,
                                    :enter
                                    #function[clojure.core/identity]})-<,
                                :execution-id 115,
                                :stack
                                ({:name :a,
                                  :enter #function[dev/fn--47949]})}
{}
dev>