Is there any way I can customize the executor? I'm adding sql logging but kinda want to turn it off for the proletariat worker's polling
(def ^:dynamic *log-sql*
true)
(defn- logging-datasource
"Wraps a datasource such that all queries that go through it are logged."
[underlying-datasource]
(let [logging-listener (doto (SLF4JQueryLoggingListener.)
(.setQueryLogEntryCreator
(DefaultQueryLogEntryCreator.))
(.setLoggingCondition
(reify LoggingCondition
(getAsBoolean [_]
*log-sql*))))]
(-> (ProxyDataSourceBuilder/create underlying-datasource)
(.listener logging-listener)
(.logQueryBySlf4j SLF4JLogLevel/INFO "lumanu.system.db")
(.name "Query Logger")
(.build))))
(defn start-db
[{:keys [jdbcUrl]}]
(logging-datasource
(connection/->pool
HikariDataSource
{:jdbcUrl jdbcUrl
:classname "org.postgresql.Driver"})))
i was thinking I could bind a dynamic var but..
there is no convenient "get underlying" method on the proxy either, which stinks
nevermind!
(.unwrap ^DataSource db HikariDataSource)