The Kernel module is now equipped with a "Log" function that writes messages to a log file.
Kernel.Log(message=None, prefix="[Kernel]", error=False)
it generates a time stamp and uses the provided prefix to create a message
so a call like this
Kernel.Log("message goes here", "[Prefix]")
will create this message
MON 24 SET 2011 15:32:19 [GMT] [Prefix] message goes here
it also has a additional option argument that will attach a trace back of the latest error to be raised to the message
so a call like this
Kernel.Log("message goes here", "[Prefix]", True)
will create a message like this
MON 24 SET 2011 15:32:19 [GMT] [Prefix] message goes here [Error] Traceback
all the arguments are optional and if Message is left as None error will be set to true.
so a call
Kernel.Log()
will generate the following message
MON 24 SET 2011 15:32:19 [GMT] [Kernel] [Error] Traceback
so, when working on the editor:
- Think of EVERYTHING that could go wrong, and create a exception for it if the error can be handled then and there. Use if elif else branches or try except finally statements to cache the case and use Kernel.Log to record the event, and attach the latest error if you just caught an exception.
- Use an informative Prefix that will tell what part of the system the message came from when logging these messages
- if an error can't be handled properly. ie. the error will cause problems with other components, let it go up to the main wx.loop where it will be caught by the Wx library. ARCed will tap the Wx main loop error caching to log the error. but this is not yet implemented
messages are written to ARCed.log in the program folder