Added logging capability if /tmp/drlaunch.log is present.
[drlaunch] / src / drlaunch_widget.py
index 54ad48c..c0f1f2a 100755 (executable)
 
 __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
 
+import os.path
 from drlaunch import widget
 
 class DrlaunchPlugin(widget.DrlaunchPlugin):
     pass
 
+def redirect_err():
+    import sys
+    import time
+
+    print "Opening /tmp/drlaunch.log"
+    f=open('/tmp/drlaunch.log', 'at', buffering=1)
+    sys.stdout=f
+    sys.stderr=f
+    print "Log open:", time.ctime()
+
 hd_plugin_type = DrlaunchPlugin
 
+if os.path.exists('/tmp/drlaunch.log'):
+    redirect_err()
+
 if __name__=="__main__":
     import gobject
     import gtk