Fork me on GitHub
#duct
<
2019-05-28
>
alex13:05:39

In following the getting started guide, I typically start the server via (dev) and (go) in the REPL. I would like to get some logging in place so that I could inspect API requests that are hitting the router. Does anyone have a recommendation for the best way to do that?

weavejester13:05:38

@rahx1t you mean beyond the logging of requests?

alex13:05:48

Currently I'm not sure I get any logging of requests. Should I be seeing that?

weavejester13:05:36

You should, but in the REPL they’re hidden in the logs directory, I believe.

weavejester13:05:08

In production, the logs output to STDOUT, but that would be annoying if it did that at the REPL.

weavejester14:05:33

You can access the logger by including a reference to the :duct/logger key. For example, the default request logging is handled by middleware that is configured like:

:duct.middleware.web/log-requests {:logger #ig/ref :duct/logger}

alex14:05:13

Ah that's great, thanks for that bit of info. I will give that a go when I get home tonight

weavejester14:05:16

I also added a few recent convenience macros that aren’t mentioned in the README, so instead of writing (duct.logger/log logger :info ::key) you can write (duct.logger/info logger ::key).

rickmoynihan17:05:08

I’ve just run into an issue with duct/exec-config where it appears that dependent #ig/refset keys aren’t started. I’m not yet sure if it’s relevant but the refset keys and the parent key are split across two different profiles. It feels like this should work, is it a known issue or have I perhaps wired something up wrong?

rickmoynihan17:05:12

the refset keys are all themselves composite keys, deriving from a base key. If I pass that base key in the set of keys that are started it works; but that feels like I’m having to restate my dependencies.

rickmoynihan17:05:37

this setup seems to work with my repl setup… I only notice it when in production envs when I use duct/exec-config

weavejester18:05:22

@rickmoynihan Are you starting with a subset of keys?

weavejester18:05:05

Refs must be resolved, otherwise there is an error, so any keys that are ref’d by others are automatically included.

weavejester18:05:32

However, Refsets can be empty, so they’re effectively a weak reference.

weavejester18:05:05

This is deliberate, as it allows logic like saying “Start X before any key deriving from Y” without automatically including all keys from Y.