You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
johnnyquest edited this page Jun 9, 2011
·
4 revisions
General-purpose message/logging function
Python
(wip)
def msg(m):
msg = "[%s <scriptname>.py] %s" % (datetime.datetime.now().strftime("%y%m%d %H:%M.%S"), m)
sys.stderr.write(msg+"\n")
print msg
# TODO: write the other functions in the MEL code (or better, a factory function)
I believe in adding lots of debug messages to my code (so it verbosely 'talks' about what it's doing). It always proves very useful in problem cases, but otherwise can be very annoying.
My solution was a log file viewer app which filters out lines with the (debug) string in them by default (with a switch in the UI to allow viewing the 'debug' version of the log).