init commit
[profile-appoint] / debug.py
diff --git a/debug.py b/debug.py
new file mode 100755 (executable)
index 0000000..16c7db2
--- /dev/null
+++ b/debug.py
@@ -0,0 +1,20 @@
+import os,time
+
+if os.path.exists("/tmp/switch.debug"):
+if True:
+    enable_logging = True
+else:
+    enable_logging = False
+
+if enable_logging and not 'fd' in locals():
+    fd = open('/tmp/switch.log','w+')
+else:
+    fd = None
+
+def debug(*input):
+    if enable_logging:
+               now = str(time.time())
+               print now+str(input)
+               print >>fd,now+str(input)
+               fd.flush()
+