-
Notifications
You must be signed in to change notification settings - Fork 1
/
LogOrganizer.py
43 lines (33 loc) · 1.42 KB
/
LogOrganizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
__author__ = "Jan-Simon Baasner"
__email__ = "[email protected]"
from enum import Enum, unique
@unique
class LogEnums (Enum):
VCF_FORMAT_CHECK_LOG = "VCF_FORMAT_CHECK_LOG".lower()
TRANSCRIPT_CDS_CREATION_LOG = "TRANSCRIPT_CDS_CREATION_LOG".lower()
TRANSCRIPT_BUGHUNTING_LOG = "TRANSCRIPT_BUGHUNTING_LOG".lower()
TRANSCRIPT_ADDITIONAL_INFO_LOG = "TRANSCRIPT_ADDITIONAL_INFO_LOG".lower()
COORDINATOR_COMPLETE_CHECK_LOG = "COORDINATOR_COMPLETE_CHECK_LOG".lower()
COORDINATOR_COMPLETE_CHECK_CRITICAL_LOG = "COORDINATOR_COMPLETE_CHECK_CRITICAL_LOG".lower()
COORDINATOR_FASTA_FILE_ERROR_LOG = "COORDINATOR_FASTA_FILE_ERROR_LOG".lower()
COORDINATOR_BUGHUNTING_LOG = "COORDINATOR_BUGHUNTING_LOG".lower()
COORDINATOR_PHASING_LOG = "COORDINATOR_PHASING_LOG".lower()
COORDINATOR_VARIANT_LOG = "COORDINATOR_VARIANT_LOG".lower()
COORDINATOR_TRANSCRIPT_LOG = "COORDINATOR_TRANSCRIPT_LOG".lower()
CONVERTER_LOG = "CONVERTER_LOG".lower()
class LogOrganizer:
log = {}
@staticmethod
def addToLog(LogName: LogEnums, text: str):
if "\n" not in text:
text += "\n"
if str(LogName.value) in LogOrganizer.log:
LogOrganizer.log[str(LogName.value)].append(text)
else:
LogOrganizer.log[str(LogName.value)] = [text]
@staticmethod
def writeAllLogs(outpath:str):
for key in LogOrganizer.log.keys():
logdata = open(str(outpath)+str(key)+".log","w")
logdata.write("".join(LogOrganizer.log[key]))
logdata.close()