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.

Improve `this.log` for rule base class

See original GitHub issue

Currently calling this.log requires a few properties to be provided manually:

        this.log({
          message: `some message`,
          line: node.loc && node.loc.start.line,
          column: node.loc && node.loc.start.column,
          source: this.sourceForNode(node),
        });

I’d like to add the ability to pass node and have line,column, and source inferred. Something like:

        this.log({
          message: `Passing the \`${specifiedKey}\` property as an argument within templates is not allowed.`,
          node,
        });

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rwjbluecommented, Feb 20, 2021

I’m not sure how that is better. In those cases, just pass those nodes in directly.

this.log({
  message: 'whatever here',
  node: elementNode.attributes[0].value
})
0reactions
lifeartcommented, Feb 20, 2021

@rwjblue I mean, if we need to highlight component tag name, we don’t need to highlight whole component block, highlighting Foo from <Foo @name={{a}} /> instead of <Foo @name={{a}} />.

and idea is add property path, and linter will figure out where this property located and highlight it.

this.log({node, part: 'tag' });
this.log({node, part: 'attributes.0.value' });
this.log({node, part: 'hash.name.key' });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Log rules: Justifying the logarithm properties (article)
In this lesson, we will prove three logarithm properties: the product rule, the quotient rule, and the power rule. Before we begin, let's...
Read more >
Logging or ignoring rule actions - IBM
Logging or ignoring rule actions. Logging actions control the level of logging based on the observed traffic. Access rules, exception rules, and extrusion...
Read more >
How to create a BaseClass that adds logging messages
Honestly it is a neat trick and if you get it working you should be proud. I think I figured something similar out...
Read more >
Understanding Log Scales and Log Rules
This rule is based on a series of diagrams outlining the sawing pattern for 1-inch lumber for each diameter and length class with...
Read more >
Define a Log Inspection rule for use in policies | Deep Security
To create Log Inspection rules, perform these basic steps: Create a new Log Inspection rule; Decoders; Subrules; Real world examples; Log Inspection rule...
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