Skip to content

Commit

Permalink
Ensure log lines confirm to utf-8 standard
Browse files Browse the repository at this point in the history
We've come across cases when certain characters break Beaver transmitting log lines. This PR ensures all log lines correctly conform to UTF-8 when they're formatted for transmission.
  • Loading branch information
JamieCressey committed Oct 29, 2015
1 parent 19a675a commit 05eb40c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions beaver/transports/base_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def callback(self, filename, lines):

def format(self, filename, line, timestamp, **kwargs):
"""Returns a formatted log line"""
line = unicode(line.encode("utf-8")[:32766], "utf-8", errors="ignore")
formatter = self._beaver_config.get_field('format', filename)
if formatter not in self._formatters:
formatter = self._default_formatter
Expand Down

0 comments on commit 05eb40c

Please sign in to comment.