Commit 30618d5a authored by James Coyle's avatar James Coyle

Draft at removing duplicate logging

parent 96171565
Pipeline #1111 failed with stages
in 2 seconds
import os import os
import re import re
import sys
import subprocess import subprocess
from storjstatus import version from storjstatus import version
import logging import logging
...@@ -24,13 +25,20 @@ def setup_logger(): ...@@ -24,13 +25,20 @@ def setup_logger():
global log global log
if (log == None): if (log == None):
logFormatter = logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', datefmt='%d/%m/%Y %I:%M:%S %p') logFormatter = logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', datefmt='%d/%m/%Y %I:%M:%S %p')
log = logging.getLogger()
log.setLevel(logging.DEBUG)
consoleHandler = logging.StreamHandler() consoleHandler = logging.StreamHandler(sys.stdout)
consoleHandler.setFormatter(logFormatter) consoleHandler.setFormatter(logFormatter)
log.addHandler(consoleHandler) logHandlers = [consoleHandler]
logging.basicConfig(
level=logging.DEBUG,
format=logFormatter,
handlers=logHandlers
)
log = logging.getLogger()
def cleanup_json(json): def cleanup_json(json):
......
...@@ -81,7 +81,7 @@ def init_send(): ...@@ -81,7 +81,7 @@ def init_send():
if not resp.status_code == 200: if not resp.status_code == 200:
print_error("Value returned when posting stats : " + resp.json()['description']) print_error("Value returned when posting stats : " + resp.json()['description'])
except Exception as e: except Exception as e:
print(str(e)) storjstatus_common.log.error(str(e))
print_error("Error sending report to: " + storjstatus_common.APIENDPOINT + "stats. Please try again later") print_error("Error sending report to: " + storjstatus_common.APIENDPOINT + "stats. Please try again later")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment