43 lines
2.0 KiB
Python
43 lines
2.0 KiB
Python
|
|
class LogEventCodes():
|
|
def __init__(self, specify=1):
|
|
self.code_list = {}
|
|
|
|
def addEventCode(self, code, details, event_state=""):
|
|
self.code_list[code] = {}
|
|
self.code_list[code]["details"] = details
|
|
self.code_list[code]["event_state"] = event_state
|
|
last_letter = code[len(code)-1]
|
|
type = "info"
|
|
match last_letter.upper():
|
|
case 'S': type = "success"
|
|
case 'F': type = "failed"
|
|
case 'W': type = "warning"
|
|
case 'E': type = "event"
|
|
case 'X': type = "error"
|
|
case 'A': type = "alert"
|
|
self.code_list[code]["type"] = type
|
|
|
|
def getEventCode(self, code):
|
|
if code in self.code_list:
|
|
return self.code_list[code]
|
|
return None
|
|
|
|
loge_codes = LogEventCodes()
|
|
|
|
loge_codes.addEventCode("CFL1000S", "The Config File loaded and the [DEFAULT] datablock is loaded.")
|
|
loge_codes.addEventCode("CFL1000X", "The [DEFAULT] datablock isn't loaded or founded, but the config file loaded.")
|
|
loge_codes.addEventCode("BLC1000S", "The html file content is loaded in the browser")
|
|
loge_codes.addEventCode("BLC1001S", "The admin html file content is loaded in the browser")
|
|
loge_codes.addEventCode("SF1000E", "The sight is being created.","CREATING")
|
|
loge_codes.addEventCode("SF1000W", "The sight is already exist with that ID. It can't be create a new one with that id.s")
|
|
loge_codes.addEventCode("SF1001W", "The sight ID is not exist. It can't be shown!")
|
|
loge_codes.addEventCode("CLA1000E", "New Active Sight.")
|
|
|
|
|
|
#EVENT BASED
|
|
loge_codes.addEventCode("MES1000E", "Mouse dragged the Sight and move to other position.", "MOVING")
|
|
loge_codes.addEventCode("MES1001E", "Mouse pressed on that windows which was in the background and it is become now active.", "PRESSED")
|
|
loge_codes.addEventCode("MES1002E", "Mouse released", "RELEASED")
|
|
loge_codes.addEventCode("MES1003E", "Mouse scrolling down", "SCROLLING_DOWN")
|
|
loge_codes.addEventCode("MES1004E", "Mouse scrolling up", "SCROLLING_UP") |