init commit
[profile-appoint] / debug.py
1 import os,time
2
3 if os.path.exists("/tmp/switch.debug"):
4 if True:
5     enable_logging = True
6 else:
7     enable_logging = False
8
9 if enable_logging and not 'fd' in locals():
10     fd = open('/tmp/switch.log','w+')
11 else:
12     fd = None
13
14 def debug(*input):
15     if enable_logging:
16                 now = str(time.time())
17                 print now+str(input)
18                 print >>fd,now+str(input)
19                 fd.flush()
20