[jToolkit-cvs] jToolkit/web __init__.py,1.3,1.4
Brought to you by:
davidfraser,
friedelwolff
|
From: <dav...@us...> - 2003-09-29 07:47:27
|
Update of /cvsroot/jtoolkit/jToolkit/web
In directory sc8-pr-cvs1:/tmp/cvs-serv3226
Modified Files:
__init__.py
Log Message:
added code to disable thread time logging unless needed...
Index: __init__.py
===================================================================
RCS file: /cvsroot/jtoolkit/jToolkit/web/__init__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** __init__.py 25 Sep 2003 17:36:55 -0000 1.3
--- __init__.py 29 Sep 2003 07:47:11 -0000 1.4
***************
*** 26,41 ****
servers = {}
! import os, thread, time
! logfilename = 'C:\\Temp\\threads.log'
! def logtime(message):
! osid = os.getpid()
! threadid = thread.get_ident()
! t = time.time()
! ms = int((t - int(t))*1000.0)
! timestr = time.strftime('%Y-%m-%d %H:%M:%S') + '.%03d' % ms
! f = open(logfilename, 'a')
! f.write('%s: pid %r tid %r: %s\n' % (timestr, osid, threadid, message))
! f.close()
# handler is in here so that we can say PythonHandler jToolkit.web
--- 26,57 ----
servers = {}
! logtimes = 0
! if logtimes:
! import os, time
! try:
! import thread
! except ImportError:
! # pretend we have threads if we don't
! def thread_get_ident():
! return 0
! class blank: pass
! thread = blank()
! thread.get_ident = thread_get_ident
! logfilename = '/tmp/threads.log'
!
! def logtime(message):
! osid = os.getpid()
! threadid = thread.get_ident()
! t = time.time()
! ms = int((t - int(t))*1000.0)
! timestr = time.strftime('%Y-%m-%d %H:%M:%S') + '.%03d' % ms
! f = open(logfilename, 'a')
! f.write('%s: pid %r tid %r: %s\n' % (timestr, osid, threadid, message))
! f.close()
! else:
! def logtime(message):
! """don't log anything as we aren't in logtimes mode"""
! pass
# handler is in here so that we can say PythonHandler jToolkit.web
|