New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging #1

mattwynne opened this Issue Aug 29, 2018 · 1 comment


None yet
1 participant

mattwynne commented Aug 29, 2018

@jbpros I wanted to start a conversation about logging.

I've been thinking we could configure a logger like this:

const { configure } = require('feynman')
configure(config => config.logger = console)

Then we should be able to see task descriptions coming out:

Given a user named Dave with email ''
  Actor dave:
    Create a user named 'dave' with email ''

Now that leaves us with how to log the bare (inter)action functions.

If you imagine defining an action like SignUp that then uses some browser interactions, it might look like this at the moment:

const SignUp = (
  as: name => ({ actor }) => 
    actor.attemptsTo("Sign up"), FillIn.fieldLabelled("Username").with(name))

We won't be able to log any of these, because (as far as I understand it) we can't ask the action function what the names of the wrapping functions / constants were that it was created by.

But we also want to keep the mechanism of defining these actions super lightweight, because the whole essence of this pattern, as I see it, is having lots and lots of these small compose-able actions, so we want to have minimal overhead on making new ones.

So could we make it possible to do this?

const { SignUp } = actions({ SignUp: ({
  as: name => ({ actor }) => 
    actor.attemptsTo("Sign up"), FillIn.fieldLabelled("Username").with(name))

The actions method would return a proxy that decorated the action function with a description built from the calls that had been made through the proxy to access the builder functions. That way we'd then be able to log it nicely, and we'd minimise the barrier to building new actions.

WDYT? Am I making sense?

mattwynne added a commit that referenced this issue Sep 12, 2018


This comment has been minimized.

Show comment
Hide comment

mattwynne Sep 12, 2018


@jbpros I think we want indentation before we call this done, WDYT?


mattwynne commented Sep 12, 2018

@jbpros I think we want indentation before we call this done, WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment