[Zope-CVS] CVS: Products/Scheduler - clock.py:1.3

Chris McDonough chrism@zope.com
Mon, 21 Apr 2003 15:08:58 -0400


Update of /cvs-repository/Products/Scheduler
In directory cvs.zope.org:/tmp/cvs-serv2774

Modified Files:
	clock.py 
Log Message:
Add logfile and errfile to options.


=== Products/Scheduler/clock.py 1.2 => 1.3 ===
--- Products/Scheduler/clock.py:1.2	Mon Aug 12 14:15:57 2002
+++ Products/Scheduler/clock.py	Mon Apr 21 15:08:57 2003
@@ -94,6 +94,10 @@
 
   -p, --period          Supply the period interval, in seconds, at which
                         the clock should notify the schedulre (default 20).
+
+  -l, --logfile         The logfile used (default: stdout) for reporting.
+
+  -e, --errfile         The error file used for error reporting (def: stderr).
 """
     print USAGE
     sys.exit(2)
@@ -106,10 +110,12 @@
     password = '123'
     period = 20
     verbosity = 0
+    logfile = sys.stdout
+    errfile = sys.stderr
 
     try:
         opts, args = getopt.getopt( sys.argv[1:]
-                                , '?hqvn:s:a:p:'
+                                , '?hqvn:s:a:p:l:e:'
                                 , [ 'help'
                                   , 'quiet'
                                   , 'verbose'
@@ -117,6 +123,8 @@
                                   , 'scheduler_path='
                                   , 'auth='
                                   , 'period='
+                                  , 'errfile='
+                                  , 'logfile='
                                   ]
                                 )
     except getopt.GetoptError:
@@ -148,12 +156,19 @@
         if k == '-p' or k == '--period':
             period = int( v )
 
+        if k == '-l' or k == '--logfile':
+            logfile = open(v, 'a')
+
+        if k == '-e' or k == '--errfile':
+            errfile = open(v, 'a')
+        
+
     Clock( scheduler_url='%s/%s' % (nethost, scheduler_path)
          , period=period
          , userid=userid
          , password=password
-         , logfile=sys.stdout
-         , errfile=sys.stderr
+         , logfile=logfile
+         , errfile=errfile
          , verbosity=verbosity
          ).run()