def format(self, filename, line, timestamp, **kwargs):
line = unicode(line.encode("<STR_LIT:utf-8>"), "<STR_LIT:utf-8>", errors="<STR_LIT:ignore>")<EOL>formatter = self._beaver_config.get_field('<STR_LIT>', filename)<EOL>if formatter not in self._formatters:<EOL><INDENT>formatter = self._default_formatter<EOL><DEDENT>data = {<EOL>self._fields.get('<STR_LIT:type>'): kwargs.get('<STR_LIT:type>'),<EOL>self._fields.get('<STR_LIT>'): kwargs.get('<STR_LIT>'),<EOL>'<STR_LIT>': timestamp,<EOL>self._fields.get('<STR_LIT:host>'): self._current_host,<EOL>self._fields.get('<STR_LIT:file>'): filename,<EOL>self._fields.get('<STR_LIT:message>'): line<EOL>}<EOL>if self._logstash_version == <NUM_LIT:0>:<EOL><INDENT>data['<STR_LIT>'] = '<STR_LIT>'.format(filename)<EOL>data['<STR_LIT>'] = kwargs.get('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>data['<STR_LIT>'] = self._logstash_version<EOL>fields = kwargs.get('<STR_LIT>')<EOL>for key in fields:<EOL><INDENT>data[key] = fields.get(key)<EOL><DEDENT><DEDENT>return self._formatters[formatter](data)<EOL>
Returns a formatted log line