r169 - in /debtorrent/trunk: DebTorrent/download_bt1.py config.debtorrent-client.ini debtorrent-client.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Mon Jul 16 00:51:48 UTC 2007


Author: camrdale-guest
Date: Mon Jul 16 00:51:48 2007
New Revision: 169

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=169
Log:
Add new output_file option to redirect all output to a file.

Modified:
    debtorrent/trunk/DebTorrent/download_bt1.py
    debtorrent/trunk/config.debtorrent-client.ini
    debtorrent/trunk/debtorrent-client.py

Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=169&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Mon Jul 16 00:51:48 2007
@@ -79,6 +79,8 @@
     ('expire_cache_data', 10,
         'the number of days after which you wish to expire old cache data ' +
         '(0 = disabled)'),
+    ('output_file', '', 
+        'file to write the output to (default is stdout)'),
     # Rate limits
     ('max_upload_rate', 0,
         'maximum kB/s to upload at (0 = no limit, -1 = automatic)'),

Modified: debtorrent/trunk/config.debtorrent-client.ini
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/config.debtorrent-client.ini?rev=169&op=diff
==============================================================================
--- debtorrent/trunk/config.debtorrent-client.ini (original)
+++ debtorrent/trunk/config.debtorrent-client.ini Mon Jul 16 00:51:48 2007
@@ -59,6 +59,15 @@
 
 # expire_cache_data = 30
 
+#
+# Output File
+#
+# The file to write the output to. If left blank or "-" is specified, the
+# output will go to standard out.
+#
+
+# output_file = "/var/log/debtorrent/debtorrent-client.log"
+
 ###############################################################################
 #                              R A T E   L I M I T S
 ###############################################################################
@@ -350,7 +359,8 @@
 #
 # Log File
 #
-# The file to write the APT request listener logs to.
+# The file to write the APT request listener logs to. If left blank or "-" is
+# specified, the output will be written to standard out.
 #
 
 # logfile = "/var/log/debtorrent/apt_access.log"

Modified: debtorrent/trunk/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-client.py?rev=169&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-client.py (original)
+++ debtorrent/trunk/debtorrent-client.py Mon Jul 16 00:51:48 2007
@@ -27,7 +27,7 @@
 from DebTorrent.download_bt1 import defaults, get_usage
 from DebTorrent.parseargs import parseargs
 from sys import argv, exit
-import os
+import os, sys
 from DebTorrent import version, report_email
 from DebTorrent.ConfigDir import ConfigDir
 
@@ -55,6 +55,10 @@
         if config['save_options']:
             configdir.saveConfig(config)
         configdir.deleteOldCacheData(config['expire_cache_data'])
+        if config['output_file'] and config['output_file'] != '-':
+            outfile = open(config['output_file'], 'a', 0)
+            sys.stdout = outfile
+            sys.stderr = outfile
     except ValueError, e:
         print 'error: ' + str(e) + '\n'
         print "Usage: debtorrent-client.py <global options>\n"




More information about the Debtorrent-commits mailing list