Small update for log functiom
This commit is contained in:
parent
911dc18ca7
commit
9fa1b54b99
@ -36,10 +36,12 @@ class GMCLCore(object):
|
|||||||
self.__LogOutput=LogOutput
|
self.__LogOutput=LogOutput
|
||||||
self.__UserAgent={'User-Agent':LauncherName+'/'+LauncherVersion+' ((GMCL Core Alpha 0.2.0;Alpha))'}
|
self.__UserAgent={'User-Agent':LauncherName+'/'+LauncherVersion+' ((GMCL Core Alpha 0.2.0;Alpha))'}
|
||||||
self.__Log=[]
|
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'''
|
'''The function which was used to manager the log output system'''
|
||||||
''':Type Type of the log info'''
|
''':Type Type of the log info'''
|
||||||
''':Text The main text of 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(Text!="" or None):
|
||||||
if(Type=="info"):
|
if(Type=="info"):
|
||||||
self.__Log.append(("INFO",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
|
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))
|
self.__Log.append(("WARN",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
|
||||||
return ("WARN",Text)
|
return ("WARN",Text)
|
||||||
elif(Type=="error"):
|
elif(Type=="error"):
|
||||||
self.__Log.append(("ERROR",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
|
self.__Log.append(("ERROR",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text,ErrorType))
|
||||||
return ("ERROR",Text)
|
raise TypeError(Text)
|
||||||
else:
|
else:
|
||||||
self.__Log.append(("OTHER",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
|
self.__Log.append(("OTHER",time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),Function,Text))
|
||||||
return ("OTHER",Text)
|
return ("OTHER",Text)
|
Reference in New Issue
Block a user