r170 - in /debtorrent/trunk: DebTorrent/download_bt1.py DebTorrent/launchmanycore.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 04:12:35 UTC 2007
Author: camrdale-guest
Date: Mon Jul 16 04:12:34 2007
New Revision: 170
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=170
Log:
Add a logging directory option and move all logging to it.
Modified:
debtorrent/trunk/DebTorrent/download_bt1.py
debtorrent/trunk/DebTorrent/launchmanycore.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=170&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Mon Jul 16 04:12:34 2007
@@ -69,7 +69,7 @@
('download_dir', '',
'directory to save the download in, blank indicates use the user\'s ' +
'home directory'),
- ( 'saveas_style', 1,
+ ('saveas_style', 1,
'How to name torrent download directory ' +
'(1 = <mirror>_dists_<suite>_<section>_binary-<arch>, ' +
'2 = <mirror> (caution: experimental))' ),
@@ -79,8 +79,9 @@
('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)'),
+ ('log_dir', '',
+ 'directory to write the logfiles to (default is to use a logs ' +
+ 'directory in the cache directory)'),
# Rate limits
('max_upload_rate', 0,
'maximum kB/s to upload at (0 = no limit, -1 = automatic)'),
@@ -133,8 +134,6 @@
('allow_get', 0,
'adds a /file?infohash={hash} url that allows users to download the ' +
'dtorrent file'),
- ('logfile', '',
- 'file to write the APT request listener logs to (default is stdout)'),
('min_time_between_log_flushes', 3.0,
'minimum time it must have been since the last flush to do another one'),
('hupmonitor', 0,
Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=170&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Mon Jul 16 04:12:34 2007
@@ -355,13 +355,17 @@
ipv6_socket_style = config['ipv6_binds_v4'],
randomizer = config['random_port'])
+ if config['log_dir']:
+ logfile = os.path.join(config['log_dir'], 'apt-access.log')
+ else:
+ logfile = os.path.join(self.configdir.cache_dir, 'apt-access.log')
+
self.aptlistener = AptListener(self, config, self.rawserver)
self.rawserver.bind(config['apt_port'], config['bind'],
reuse = True, ipv6_socket_style = config['ipv6_binds_v4'])
self.rawserver.set_handler(HTTPHandler(self.aptlistener.get,
config['min_time_between_log_flushes'],
- config['logfile'],
- config['hupmonitor']),
+ logfile, config['hupmonitor']),
config['apt_port'])
self.ratelimiter = RateLimiter(self.rawserver.add_task,
Modified: debtorrent/trunk/config.debtorrent-client.ini
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/config.debtorrent-client.ini?rev=170&op=diff
==============================================================================
--- debtorrent/trunk/config.debtorrent-client.ini (original)
+++ debtorrent/trunk/config.debtorrent-client.ini Mon Jul 16 04:12:34 2007
@@ -27,7 +27,7 @@
# home directory will be used.
#
-# download_dir = "/var/cache/debtorrent"
+# download_dir = ""
#
# SaveAs Style
@@ -48,7 +48,7 @@
# .DebTorrent directory in the user's home directory will be used.
#
-# cache_dir = "/var/cache/debtorrent/.DebTorrent"
+# cache_dir = ""
#
# Expire Cache Data
@@ -60,13 +60,13 @@
# 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"
+# Log Directory
+#
+# The directory to write the output logs to. If left blank, a "logs" directory
+# in the cache directory will be used.
+#
+
+# log_dir = ""
###############################################################################
# R A T E L I M I T S
@@ -357,15 +357,6 @@
# allow_get = 0
#
-# Log File
-#
-# 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"
-
-#
# Min Time Between Log Flushes
#
# The minimum time it must have been since the last log flush to do another
Modified: debtorrent/trunk/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-client.py?rev=170&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-client.py (original)
+++ debtorrent/trunk/debtorrent-client.py Mon Jul 16 04:12:34 2007
@@ -55,10 +55,13 @@
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
+ if config['log_dir']:
+ outfilename = os.path.join(config['log_dir'], 'debtorrent-client.log')
+ else:
+ outfilename = os.path.join(configdir.cache_dir, 'debtorrent-client.log')
+ outfile = open(outfilename, '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