interagent / pliny

An opinionated toolkit for writing excellent APIs in Ruby.
MIT License
801 stars 73 forks source link

Replace newlines in log strings #333

Closed bensymonds closed 3 years ago

bensymonds commented 4 years ago

Pliny logging follows the "logfmt" pattern. logfmt is unclear on what should happen with newline characters, but given it's line-based it doesn't seem to make sense to include them in the body of the log line. I couldn't decide between removing, replacing with a space character, or escaping. In the end I went with escaping since it makes it clear to a viewer that a newline was there.

This includes a small refactor - see the commits for details.

bensymonds commented 3 years ago

@stevenharman If you're thinking about merging and releasing #338, maybe we could get this one in too?