Skip to content
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

fix(dot/network): Avoid printing extrinsic in TransactionMessage. #1728

Merged
merged 2 commits into from
Aug 14, 2021

Conversation

arijitAD
Copy link
Contributor

@arijitAD arijitAD commented Aug 13, 2021

Changes

  • Avoid printing extrinsics in TransactionMessage

"msg", msg.String(),

  • Even though msg.String() is written inside Trace this gets if we have set the logging level to Info but the log is not printed
  • Wrote a go program to verify this

Code:

func printLevel(lvl string) string {
    fmt.Println("Inside: ", lvl)
    return lvl
}

func TestLogger(t *testing.T) {
    lgr := log.New("pkg", "babe")
    handler := log.StreamHandler(os.Stdout, log.TerminalFormat())
    handler = log.CallerFileHandler(handler)
    lgr.SetHandler(log.LvlFilterHandler(log.LvlInfo, handler))
    lgr.Info("Data", "Level", printLevel("Info"))
    lgr.Trace("Data", "Level", printLevel("Trace"))
}

Output:

Screenshot 2021-08-13 at 5 48 52 PM

Memory profile:

Screenshot 2021-08-13 at 5 35 51 PM

Screenshot 2021-08-13 at 5 36 16 PM

Tests


Issues

Primary Reviewer

@codecov
Copy link

codecov bot commented Aug 13, 2021

Codecov Report

Merging #1728 (cccc54f) into development (9a76d39) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #1728      +/-   ##
===============================================
+ Coverage        58.90%   58.99%   +0.08%     
===============================================
  Files              183      183              
  Lines            19081    19081              
===============================================
+ Hits             11240    11257      +17     
+ Misses            5901     5887      -14     
+ Partials          1940     1937       -3     
Flag Coverage Δ
unit-tests 58.99% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dot/network/transaction.go 46.34% <100.00%> (ø)
dot/network/connmgr.go 83.33% <0.00%> (+0.92%) ⬆️
lib/babe/babe.go 59.00% <0.00%> (+2.29%) ⬆️
lib/blocktree/leaves.go 95.12% <0.00%> (+4.87%) ⬆️
dot/state/block_notify.go 82.95% <0.00%> (+9.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a76d39...cccc54f. Read the comment docs.

@arijitAD arijitAD merged commit d2965ac into development Aug 14, 2021
@arijitAD arijitAD deleted the fix-memory branch August 14, 2021 10:41
@github-actions
Copy link

github-actions bot commented Dec 3, 2021

🎉 This PR is included in version 0.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

timwu20 pushed a commit to timwu20/gossamer that referenced this pull request Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants