From 60da84fd3b18d8f630e8d66d7d5ff841bc29002a Mon Sep 17 00:00:00 2001 From: jowj Date: Tue, 2 Oct 2018 18:13:33 -0500 Subject: [PATCH] Update logging syntax to be Actually Correct. --- arke.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arke.py b/arke.py index a2a9c2d..cd82bd9 100644 --- a/arke.py +++ b/arke.py @@ -1,12 +1,9 @@ import requests, arkevars, json, logging -FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s" -logging.basicConfig(format=FORMAT) -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%Y/%m/%d %I:%M:%S %p',level=logging.INFO,filename='example.log') logger = logging.getLogger("arke") -def gather_JsonData(monitoringtargets): - responseTable = {} +def monitor_AllTargets(monitoringtargets): for target in monitoringtargets: try: statuscode = requests.get(target).status_code @@ -14,8 +11,6 @@ def gather_JsonData(monitoringtargets): # prints the int of the status code. Find more at httpstatusrappers.com :) except requests.ConnectionError: - logger.info(f"target: {target} ERROR: Failure to connect.") - - return responseTable + logger.warn(f"target: {target} ERROR: Failure to connect.") -gather_JsonData(arkevars.httpTargets) \ No newline at end of file +monitor_AllTargets(arkevars.httpTargets)