remove things from base class that were never used

This commit is contained in:
AlanCoding 2018-11-19 08:03:36 -05:00
parent 017d367749
commit 127495b53d
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -24,10 +24,13 @@ class TimeFormatter(logging.Formatter):
class LogstashFormatterBase(logging.Formatter):
"""Base class taken from python-logstash=0.4.6
modified here since that version
License in docs/licenses/
"""
def __init__(self, message_type='Logstash', tags=None, fqdn=False):
def __init__(self, message_type='Logstash', fqdn=False):
self.message_type = message_type
self.tags = tags if tags is not None else []
if fqdn:
self.host = socket.getfqdn()
@ -77,10 +80,6 @@ class LogstashFormatterBase(logging.Formatter):
return fields
@classmethod
def format_source(cls, message_type, host, path):
return "%s://%s/%s" % (message_type, host, path)
@classmethod
def format_timestamp(cls, time):
tstamp = datetime.utcfromtimestamp(time)
@ -234,10 +233,8 @@ class LogstashFormatter(LogstashFormatterBase):
def format(self, record):
message = {
# Fields not included, but exist in related logs
# Field not included, but exist in related logs
# 'path': record.pathname
# '@version': '1', # from python-logstash
# 'tags': self.tags,
'@timestamp': self.format_timestamp(record.created),
'message': record.getMessage(),
'host': self.host,