kazu-yamamoto / logger

A fast logging system for Haskell
159 stars 68 forks source link

add ToLogStr instance for bytestring builder #168

Closed andrewthad closed 5 years ago

andrewthad commented 5 years ago

Resolves https://github.com/kazu-yamamoto/logger/issues/147. This instance is a little unintuitive. The bytestring builder must be materialized to a lazy bytestring to give us access to the length. Rather than putting the original Builder argument in the LogStr, we create a new builder from this lazy bytestring. This avoids duplicating work, which helps when computation inside a Builder is expensive.

kazu-yamamoto commented 5 years ago

Sorry for the delay. I have rebased and merged this PR. Thank you for your contribution!