|
@ -32,11 +32,13 @@ class LogzioSender: |
|
|
def __init__(self, |
|
|
def __init__(self, |
|
|
token, url='https://listener.logz.io:8071', |
|
|
token, url='https://listener.logz.io:8071', |
|
|
logs_drain_timeout=5, |
|
|
logs_drain_timeout=5, |
|
|
debug=False): |
|
|
|
|
|
|
|
|
debug=False, |
|
|
|
|
|
backup_logs=True): |
|
|
self.token = token |
|
|
self.token = token |
|
|
self.url = '{}/?token={}'.format(url, token) |
|
|
self.url = '{}/?token={}'.format(url, token) |
|
|
self.logs_drain_timeout = logs_drain_timeout |
|
|
self.logs_drain_timeout = logs_drain_timeout |
|
|
self.logger = get_logger(debug) |
|
|
self.logger = get_logger(debug) |
|
|
|
|
|
self.backup_logs = backup_logs |
|
|
|
|
|
|
|
|
# Function to see if the main thread is alive |
|
|
# Function to see if the main thread is alive |
|
|
self.is_main_thread_active = lambda: any( |
|
|
self.is_main_thread_active = lambda: any( |
|
@ -144,7 +146,7 @@ class LogzioSender: |
|
|
sleep(sleep_between_retries) |
|
|
sleep(sleep_between_retries) |
|
|
sleep_between_retries *= 2 |
|
|
sleep_between_retries *= 2 |
|
|
|
|
|
|
|
|
if should_backup_to_disk: |
|
|
|
|
|
|
|
|
if should_backup_to_disk and self.backup_logs: |
|
|
# Write to file |
|
|
# Write to file |
|
|
self.logger.info( |
|
|
self.logger.info( |
|
|
'Could not send logs to Logz.io after %s tries, ' |
|
|
'Could not send logs to Logz.io after %s tries, ' |
|
|