5 import sys, time, string
8 DEV_UPDATE =
"update queries" 9 DEV_SELECT =
"select queries" 10 DEV_REPORT =
"report log" 23 if LOGGING_STATUS[when]:
33 time_stamp =
"%5.5f" % (t-tstart)
36 sys.stderr.write(
"[%s] %s" % (time_stamp, astr))
38 sys.stderr.write(
"[%s] %s\n" % (time_stamp, astr))
45 time_stamp = time.strftime(
"%m/%d %T", time.localtime(t))
48 sys.stderr.write(
"[%s] %s" % (time_stamp, astr))
50 sys.stderr.write(
"[%s] %s\n" % (time_stamp, astr))
70 def ansicolor (str, fgcolor = None, bgcolor = None):
77 o = o +
'%c[3%d%sm' % (chr(27), fgcolor & 0x7, bright)
79 o = o +
'%c[4%dm' % (chr(27), bgcolor)
81 if fgcolor
or bgcolor:
82 o = o +
'%c[0m' % (chr(27))
91 log_line = log_line +
"[" + time.strftime(
"%m/%d %T", time.localtime(t)) +
"] " 96 log_line = log_line + string.join(l,
" ") +
"\n" 98 sys.stderr.write(log_line)
104 args = tuple ([
"[31m"] + list(args) + [
"[0m"])
113 args = tuple ([
"[31m"] + list(args) + [
"[0m"])
117 if _gDebug>=2: apply(_log, args)
def ansicolor(str, fgcolor=None, bgcolor=None)