mirror of
https://github.com/ansible/awx.git
synced 2026-02-24 14:36:00 -03:30
remove things from base class that were never used
This commit is contained in:
@@ -24,10 +24,13 @@ class TimeFormatter(logging.Formatter):
|
|||||||
|
|
||||||
|
|
||||||
class LogstashFormatterBase(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.message_type = message_type
|
||||||
self.tags = tags if tags is not None else []
|
|
||||||
|
|
||||||
if fqdn:
|
if fqdn:
|
||||||
self.host = socket.getfqdn()
|
self.host = socket.getfqdn()
|
||||||
@@ -77,10 +80,6 @@ class LogstashFormatterBase(logging.Formatter):
|
|||||||
|
|
||||||
return fields
|
return fields
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def format_source(cls, message_type, host, path):
|
|
||||||
return "%s://%s/%s" % (message_type, host, path)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def format_timestamp(cls, time):
|
def format_timestamp(cls, time):
|
||||||
tstamp = datetime.utcfromtimestamp(time)
|
tstamp = datetime.utcfromtimestamp(time)
|
||||||
@@ -234,10 +233,8 @@ class LogstashFormatter(LogstashFormatterBase):
|
|||||||
|
|
||||||
def format(self, record):
|
def format(self, record):
|
||||||
message = {
|
message = {
|
||||||
# Fields not included, but exist in related logs
|
# Field not included, but exist in related logs
|
||||||
# 'path': record.pathname
|
# 'path': record.pathname
|
||||||
# '@version': '1', # from python-logstash
|
|
||||||
# 'tags': self.tags,
|
|
||||||
'@timestamp': self.format_timestamp(record.created),
|
'@timestamp': self.format_timestamp(record.created),
|
||||||
'message': record.getMessage(),
|
'message': record.getMessage(),
|
||||||
'host': self.host,
|
'host': self.host,
|
||||||
|
|||||||
Reference in New Issue
Block a user