From fb5c06eb8b951df50e151041934d752d1158213e Mon Sep 17 00:00:00 2001 From: Adar Hilsenrat <50073577+hilsenrat@users.noreply.github.com> Date: Sun, 10 May 2020 16:32:09 +0300 Subject: [PATCH] Logging warning on a failed try to send to logz.io (#56) Logging error only if all retries fails --- logzio/sender.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logzio/sender.py b/logzio/sender.py index 34499ee..d158dab 100644 --- a/logzio/sender.py +++ b/logzio/sender.py @@ -145,7 +145,7 @@ class LogzioSender: should_backup_to_disk = False break except Exception as e: - self.logger.error( + self.logger.warning( 'Got exception while sending logs to Logz.io, ' 'Try (%s/%s). Message: %s', current_try + 1, number_of_retries, e) @@ -157,7 +157,7 @@ class LogzioSender: if should_backup_to_disk and self.backup_logs: # Write to file - self.logger.info( + self.logger.error( 'Could not send logs to Logz.io after %s tries, ' 'backing up to local file system', number_of_retries) backup_logs(logs_list, self.logger)