mirror of https://github.com/MISP/misp-dashboard
fix: [logs:helper] Helpers get their own log file
parent
97894d06f0
commit
7e44e00788
|
@ -39,12 +39,16 @@ class Contributor_helper:
|
|||
if not os.path.exists(logDir):
|
||||
os.makedirs(logDir)
|
||||
try:
|
||||
logging.basicConfig(filename=logPath, filemode='a', level=logging.INFO)
|
||||
handler = logging.FileHandler(logPath)
|
||||
except PermissionError as error:
|
||||
print(error)
|
||||
print("Please fix the above and try again.")
|
||||
sys.exit(126)
|
||||
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
#honorBadge
|
||||
self.honorBadgeNum = len(self.cfg_org_rank.options('HonorBadge'))
|
||||
|
|
|
@ -38,12 +38,16 @@ class Geo_helper:
|
|||
if not os.path.exists(logDir):
|
||||
os.makedirs(logDir)
|
||||
try:
|
||||
logging.basicConfig(filename=logPath, filemode='a', level=logging.INFO)
|
||||
handler = logging.FileHandler(logPath)
|
||||
except PermissionError as error:
|
||||
print(error)
|
||||
print("Please fix the above and try again.")
|
||||
sys.exit(126)
|
||||
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
self.keyCategCoord = "GEO_COORD"
|
||||
self.keyCategCountry = "GEO_COUNTRY"
|
||||
|
|
|
@ -23,12 +23,16 @@ class Live_helper:
|
|||
if not os.path.exists(logDir):
|
||||
os.makedirs(logDir)
|
||||
try:
|
||||
logging.basicConfig(filename=logPath, filemode='a', level=logging.INFO)
|
||||
handler = logging.FileHandler(logPath)
|
||||
except PermissionError as error:
|
||||
print(error)
|
||||
print("Please fix the above and try again.")
|
||||
sys.exit(126)
|
||||
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
def publish_log(self, zmq_name, name, content, channel=None):
|
||||
channel = channel if channel is not None else self.CHANNEL
|
||||
|
|
|
@ -32,12 +32,16 @@ class Trendings_helper:
|
|||
if not os.path.exists(logDir):
|
||||
os.makedirs(logDir)
|
||||
try:
|
||||
logging.basicConfig(filename=logPath, filemode='a', level=logging.INFO)
|
||||
handler = logging.FileHandler(logPath)
|
||||
except PermissionError as error:
|
||||
print(error)
|
||||
print("Please fix the above and try again.")
|
||||
sys.exit(126)
|
||||
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
''' SETTER '''
|
||||
|
||||
|
|
|
@ -29,12 +29,16 @@ class Users_helper:
|
|||
if not os.path.exists(logDir):
|
||||
os.makedirs(logDir)
|
||||
try:
|
||||
logging.basicConfig(filename=logPath, filemode='a', level=logging.INFO)
|
||||
handler = logging.FileHandler(logPath)
|
||||
except PermissionError as error:
|
||||
print(error)
|
||||
print("Please fix the above and try again.")
|
||||
sys.exit(126)
|
||||
formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(name)s:%(message)s')
|
||||
handler.setFormatter(formatter)
|
||||
self.logger = logging.getLogger(__name__)
|
||||
self.logger.setLevel(logging.INFO)
|
||||
self.logger.addHandler(handler)
|
||||
|
||||
def add_user_login(self, timestamp, org, email=''):
|
||||
timestampDate = datetime.datetime.fromtimestamp(float(timestamp))
|
||||
|
|
Loading…
Reference in New Issue