question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for logging additional data with an action

See original GitHub issue

So current action API does not allow for logging additional (dynamic) data. When i expand an action in the “Actions” tab, i always see isTrusted: true (using @storybook/web-components here).

Some use cases:

  • Log event.detail in case of CustomEvents emitted from my web components (make this work automatically if detail is present?)
  • Log some component state as part of the event (whether a checkbox is checked as part of the change event)
  • Event properties (whether or not it bubbles, is cancellable or is composed (crosses shadow DOM boundary))

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
shilmancommented, Aug 22, 2020

Why not just define a custom action, something like:

const clicked = action('clicked');
return <Button onClick={(e) => clicked({ ...e, someData })} />

Or even:

const annotatedAction = (label, extraData) => {
  const original = action('label');
  return (data) => original({ ...data, ...extraData });
}
1reaction
jpzwartecommented, Aug 24, 2020

@shilman I’ve verified that it works great:

<Story name="Example" argTypes={{ onClick: { action: 'clicked' }}}>
  {({ onClick }) => html`<button @click=${event => onClick('foo', 'bar', event)}>Foo</button>`}
</Story>
Screen Shot 2020-08-24 at 15 31 47
Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Logging for IIS - Custom Logging
In the Actions pane, click Edit Logging Fields to open the Edit Logging Fields dialog box. The dialog box displays the logging fields...
Read more >
Exceptional : Adding Log Data
It's very useful for having a single place to handle adding additional data based on the command type.
Read more >
Logging HOWTO — Python 3.11.1 documentation
To log variable data, use a format string for the event description message and append the variable data as arguments. For example: import...
Read more >
Logging or ignoring rule actions
If the Allow action is selected, no other actions can be added to the rule. Log Only: Log ... Update the counter but...
Read more >
Python Logging Guide - Best Practices and Hands-on ...
Log data is often a log message, which is a string, along with some extra data to be logged. Often, the logging API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found