mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
remove timestamp by default
This commit is contained in:
parent
2acc9332f1
commit
69b464dd02
@ -15,6 +15,7 @@ class Notifier:
|
|||||||
# particularly useful for integrating the Python notify system
|
# particularly useful for integrating the Python notify system
|
||||||
# with the C++ notify system.
|
# with the C++ notify system.
|
||||||
streamWriter = None
|
streamWriter = None
|
||||||
|
showTime = 0
|
||||||
|
|
||||||
def __init__(self, name, logger=None):
|
def __init__(self, name, logger=None):
|
||||||
"""
|
"""
|
||||||
@ -37,6 +38,9 @@ class Notifier:
|
|||||||
self.__warning = 1
|
self.__warning = 1
|
||||||
self.__debug = 0
|
self.__debug = 0
|
||||||
self.__logging = 0
|
self.__logging = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def setServerDelta(self, delta, timezone):
|
def setServerDelta(self, delta, timezone):
|
||||||
"""
|
"""
|
||||||
@ -117,7 +121,11 @@ class Notifier:
|
|||||||
Raise an exception with given string and optional type:
|
Raise an exception with given string and optional type:
|
||||||
Exception: error
|
Exception: error
|
||||||
"""
|
"""
|
||||||
string = (self.getTime() + str(exception) + ": " + self.__name + ": " + errorString)
|
message = str(errorString)
|
||||||
|
if Notifier.showTime:
|
||||||
|
string = (self.getTime() + str(exception) + ": " + self.__name + ": " + message)
|
||||||
|
else:
|
||||||
|
string = (str(exception) + ": " + self.__name + ": " + message)
|
||||||
self.__log(string)
|
self.__log(string)
|
||||||
raise exception(errorString)
|
raise exception(errorString)
|
||||||
|
|
||||||
@ -127,7 +135,11 @@ class Notifier:
|
|||||||
Issue the warning message if warn flag is on
|
Issue the warning message if warn flag is on
|
||||||
"""
|
"""
|
||||||
if self.__warning:
|
if self.__warning:
|
||||||
string = (self.getTime() + self.__name + '(warning): ' + warningString)
|
message = str(warningString)
|
||||||
|
if Notifier.showTime:
|
||||||
|
string = (self.getTime() + self.__name + '(warning): ' + message)
|
||||||
|
else:
|
||||||
|
string = (":" + self.__name + 'warning: ' + message)
|
||||||
self.__log(string)
|
self.__log(string)
|
||||||
self.__print(string)
|
self.__print(string)
|
||||||
return 1 # to allow assert myNotify.warning("blah")
|
return 1 # to allow assert myNotify.warning("blah")
|
||||||
@ -150,7 +162,11 @@ class Notifier:
|
|||||||
Issue the debug message if debug flag is on
|
Issue the debug message if debug flag is on
|
||||||
"""
|
"""
|
||||||
if self.__debug:
|
if self.__debug:
|
||||||
string = (self.getTime() + self.__name + '(debug): ' + debugString)
|
message = str(debugString)
|
||||||
|
if Notifier.showTime:
|
||||||
|
string = (self.getTime() + self.__name + ':debug: ' + message)
|
||||||
|
else:
|
||||||
|
string = (':' + self.__name + ':debug: ' + message)
|
||||||
self.__log(string)
|
self.__log(string)
|
||||||
self.__print(string)
|
self.__print(string)
|
||||||
return 1 # to allow assert myNotify.debug("blah")
|
return 1 # to allow assert myNotify.debug("blah")
|
||||||
@ -173,7 +189,11 @@ class Notifier:
|
|||||||
Print the given informational string, if info flag is on
|
Print the given informational string, if info flag is on
|
||||||
"""
|
"""
|
||||||
if self.__info:
|
if self.__info:
|
||||||
string = (self.getTime() + self.__name + '(info): ' + infoString)
|
message = str(infoString)
|
||||||
|
if Notifier.showTime:
|
||||||
|
string = (self.getTime() + self.__name + ':info: ' + message)
|
||||||
|
else:
|
||||||
|
string = (':' + self.__name + ':info: ' + message)
|
||||||
self.__log(string)
|
self.__log(string)
|
||||||
self.__print(string)
|
self.__print(string)
|
||||||
return 1 # to allow assert myNotify.info("blah")
|
return 1 # to allow assert myNotify.info("blah")
|
||||||
@ -268,10 +288,11 @@ class Notifier:
|
|||||||
the function call (with parameters).
|
the function call (with parameters).
|
||||||
"""
|
"""
|
||||||
if self.__debug:
|
if self.__debug:
|
||||||
|
message = str(debugString)
|
||||||
string = ":%s:%s \"%s\" %s"%(
|
string = ":%s:%s \"%s\" %s"%(
|
||||||
self.getOnlyTime(),
|
self.getOnlyTime(),
|
||||||
self.__name,
|
self.__name,
|
||||||
debugString,
|
message,
|
||||||
PythonUtil.traceParentCall())
|
PythonUtil.traceParentCall())
|
||||||
self.__log(string)
|
self.__log(string)
|
||||||
self.__print(string)
|
self.__print(string)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user