forked from LBRYCommunity/lbry-sdk
switch error event to use log record and add more details
This commit is contained in:
parent
b7478ba817
commit
565f26bdad
3 changed files with 9 additions and 6 deletions
|
@ -60,10 +60,13 @@ class Events(object):
|
|||
properties = download_properties(*args, **kwargs)
|
||||
return self._event('Download Finished', properties)
|
||||
|
||||
def error(self, message, sd_hash=None):
|
||||
def error(self, log_record):
|
||||
"""Record when a log message of ERROR or higher was emitted"""
|
||||
properties = {
|
||||
'message': message,
|
||||
'stream_info': sd_hash
|
||||
'message': log_record.message,
|
||||
'module': log_record.module,
|
||||
'lineno': log_record.lineno,
|
||||
'name': log_record.name,
|
||||
}
|
||||
return self._event('Error', properties)
|
||||
|
||||
|
|
|
@ -8,4 +8,4 @@ class Handler(logging.Handler):
|
|||
logging.Handler.__init__(self, level)
|
||||
|
||||
def emit(self, record):
|
||||
self.manager.send_error(record.message)
|
||||
self.manager.send_error(record)
|
||||
|
|
|
@ -82,8 +82,8 @@ class Manager(object):
|
|||
event = self.events_generator.download_finished(id_, name, stream_info)
|
||||
self.analytics_api.track(event)
|
||||
|
||||
def send_error(self, message, sd_hash=None):
|
||||
event = self.events_generator.error(message, sd_hash)
|
||||
def send_error(self, message):
|
||||
event = self.events_generator.error(message)
|
||||
self.analytics_api.track(event)
|
||||
|
||||
def register_repeating_metric(self, event_name, value_generator, frequency=300):
|
||||
|
|
Loading…
Reference in a new issue