updated log levels

This commit is contained in:
Jonathan Branan 2022-11-01 16:10:22 -05:00
parent 61c627df91
commit 5732951cde
2 changed files with 7 additions and 3 deletions

View File

@ -1,10 +1,14 @@
def cont_log(self):
"""Setting up the log file, if self.use_log is set to true and self.loglevel is DEBUG OR INFO"""
if self.use_log:
if self.log_level == 'DEBUG':
if self.log_level.lower() == 'debug':
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.DEBUG)
elif self.log_level == 'INFO':
elif self.log_level.lower() == 'info':
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.INFO)
elif self.log_level.lower() == 'warn':
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.WARN)
elif self.log_level.lower() == 'error':
self.tl.basicConfig(filename=self.log_path, format='%(asctime)s:%(levelname)s:%(message)s', encoding='utf-8', datefmt='%m/%d/%Y %I:%M:%S %p',level=self.tl.ERROR)
def cont_notify(self):
"""Seting up to use pushover, if self.use_pushover is set to true and

View File

@ -54,7 +54,7 @@ class Crn:
self.tl.debug('Building container list.')
self.process_cont_list_response = process_cont_list(self.cont_list, c_start_container, self.cc, self.host, self.port, self.jwt, self.endpoint)
if self.process_cont_list_response:
self.tl.info(f'Started: [{self.process_cont_list_response}]')
self.tl.warn(f'Started: [{self.process_cont_list_response}]')
except requests.exceptions.RequestException as e:
self.tl.exception(e)