Small update for log functiom

This commit is contained in:
Bigsk 2020-11-18 15:38:23 +08:00
parent 911dc18ca7
commit 9fa1b54b99

View File

@ -36,10 +36,12 @@ class GMCLCore(object):
self.__LogOutput=LogOutput
self.__UserAgent={'User-Agent':LauncherName+'/'+LauncherVersion+' ((GMCL Core Alpha 0.2.0;Alpha))'}
self.__Log=[]
def Log(self,Type,Text,Function="Anonymous Function"):
def Log(self,Type,Text,Function="Anonymous Function",ErrorType="TypeError"):
'''The function which was used to manager the log output system'''
''':Type Type of the log info'''
''':Text The main text of log info'''
''':Function The function that cause the log,the default value is "Anonymous Function"'''
''':Type The type of the error,the default value is "TypeError"'''
if(Text!="" or None):
if(Type=="info"):
self.__Log.append(("INFO",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
@ -48,8 +50,8 @@ class GMCLCore(object):
self.__Log.append(("WARN",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
return ("WARN",Text)
elif(Type=="error"):
self.__Log.append(("ERROR",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
return ("ERROR",Text)
self.__Log.append(("ERROR",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text,ErrorType))
raise TypeError(Text)
else:
self.__Log.append(("OTHER",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
return ("OTHER",Text)