Fork me on GitHub
#duct
<
2018-11-22
>
weavejester11:11:11

@flowthing That looks like the README hasn't been updated to reflect the code. Would you mind opening an issue for it?

flowthing11:11:04

I can make a PR.

ijmo14:11:14

A newbie question. How can I use logger.timbre in handlers? I don't know how to get the initialized logger/Logger.

weavejester18:11:16

You can pass in a reference to :duct/logger

weavejester18:11:58

For example:

:app.handler/whatever
{:logger #ig/ref :duct/logger}

weavejester18:11:35

The :duct.module/logging module sets the configuration up with default logging configurations for both dev and prod.

weavejester18:11:50

In your handler itself, you'd access the logger like:

weavejester18:11:42

(defmethod ig/init-key :app.handler/whatever [_ {:keys [logger]}]
  (log/log logger :info ::message))

weavejester18:11:19

Newer versions of the duct/logger library also allow for (log/info logger ::message) as a shortcut.

ijmo00:11:50

I got it. Thanks.

ijmo00:11:36

If I want to use logger in ig/halt-key, then return {:server server :logger logger} is the way?

ijmo00:11:02

Thank you very much!

weavejester00:11:31

In Integrant 0.8.0-alpha2 I've added a resolve-key multimethod that might be useful if you just want to use the server in references.

weavejester00:11:49

Though it's still experimental functionality.

ijmo00:11:08

That sounds great.