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.

Events logs really interesting even when tests pass.

See original GitHub issue

Truffle shows events shot by a contract when its test fail. That is really a cool feature that may be interesting even when tests successfully pass.

I personally use Events to understand better how my contract behaves while testing them. For instance:

event Test(uint testID);
​
function someFunction (address addr, uint _uint) returns (bool) {
        if (a)  { Test(111); return false;}
        if(b)) {Test(112); return false;}   
[...] }

// or 
    for (uint i=0; i<n; i++) {
            if (a(i)) {Test(i); return false;}
        }

I’m currently adding a assert.equal(1,2) at the end to have access to those events, but might be an interesting feature to have.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:15
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
p14ncommented, Jun 21, 2017
1reaction
tcoultercommented, Jul 22, 2016

@HCharlanes Good feature. It’d likely need to be added via the console, i.e., truffle test --show-events, or something to that effect. Marking as enhancement and putting on the list of things to work on.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Everything You Ever Wanted to Know About Events and Logs ...
You probably suspect that Events and Logs aren't entirely separate concepts, and you're right. They are interconnected. Remember how the address ...
Read more >
Log source test connection is successful, but no events show ...
Log source test connection is successful, but no events show up in log activity even if they get rerieved during the test.
Read more >
Important Windows Event IDs: Which Events You Should…
Look for events like Scan failed, Malware detected, and Failed to update signatures. Hackers try to hide their presence. Event ID 104 Event...
Read more >
What Event Logs? Part 1: Attacker Tricks to Remove Event Logs
Many analysts rely on Windows Event Logs to help gain context of attacker activity on a system, with log entries serving as the...
Read more >
Unit testing that events are raised in C# (in order)
This is very old and probably wont even be read but with some cool new ... which instead of just logging the sequence...
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