duct

Alex 2019-05-28T13:53:39.004800Z

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?

2019-05-28T13:54:38.005300Z

@rahx1t you mean beyond the logging of requests?

Alex 2019-05-28T13:55:48.005700Z

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

2019-05-28T13:56:36.006500Z

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

2019-05-28T13:58:08.008500Z

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

2019-05-28T14:00:33.009800Z

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}

Alex 2019-05-28T14:01:13.010Z

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

2019-05-28T14:01:35.010200Z

Check out: https://github.com/duct-framework/logger

2019-05-28T14:03:16.011600Z

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).

2019-05-28T17:27:08.014100Z

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?

2019-05-28T17:29:12.015500Z

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.

2019-05-28T17:30:37.016700Z

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

2019-05-28T18:49:22.017300Z

@rickmoynihan Are you starting with a subset of keys?

2019-05-28T18:50:05.018200Z

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

2019-05-28T18:50:32.018800Z

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

2019-05-28T18:51:05.019500Z

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