ChainSafe / js-libp2p-yamux

Typescript implementation of Yamux
Other
10 stars 8 forks source link

fix: do not stringify headers for logging #61

Closed achingbrain closed 7 months ago

achingbrain commented 7 months ago

The frame headers are passed through the stringifyHeader for trace logging if a logger exists. Unfortunately a logger is set by default so this always occurs.

If we need to log these things as a string, checking that the logger is enabled is one option:

if (this.log.enabled) {
  // do expensive logging operation
}

Another is adding a custom formatter to the log class, or just having the header object appear in the console.

codecov-commenter commented 7 months ago

Codecov Report

Attention: 29 lines in your changes are missing coverage. Please review.

Files Coverage Δ
src/encode.ts 100.00% <100.00%> (ø)
test/codec.spec.ts 100.00% <100.00%> (ø)
test/compliance.spec.ts 100.00% <100.00%> (ø)
test/decode.spec.ts 96.01% <100.00%> (-0.02%) :arrow_down:
test/muxer.spec.ts 100.00% <100.00%> (ø)
test/stream.spec.ts 100.00% <100.00%> (+0.90%) :arrow_up:
test/util.ts 100.00% <100.00%> (ø)
src/decode.ts 93.75% <88.88%> (-1.39%) :arrow_down:
src/stream.ts 98.01% <99.08%> (+2.52%) :arrow_up:
test/codec.util.ts 94.28% <66.66%> (ø)
... and 2 more

:loudspeaker: Thoughts on this report? Let us know!

github-actions[bot] commented 7 months ago

:tada: This PR is included in version 5.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: