[Checkins] SVN: relstorage/trunk/relstorage/zodbconvert.py Do not write to sys.stdout.write in the zodbconvert main method, just use logging.
Maurits van Rees
m.van.rees at zestsoftware.nl
Fri Jan 7 12:03:15 EST 2011
Log message for revision 119444:
Do not write to sys.stdout.write in the zodbconvert main method, just use logging.
Changed:
U relstorage/trunk/relstorage/zodbconvert.py
-=-
Modified: relstorage/trunk/relstorage/zodbconvert.py
===================================================================
--- relstorage/trunk/relstorage/zodbconvert.py 2011-01-07 17:00:30 UTC (rev 119443)
+++ relstorage/trunk/relstorage/zodbconvert.py 2011-01-07 17:03:14 UTC (rev 119444)
@@ -56,7 +56,7 @@
return True
-def main(argv=sys.argv, write=sys.stdout.write):
+def main(argv=sys.argv):
parser = optparse.OptionParser(description=__doc__,
usage="%prog [options] config_file")
parser.add_option(
@@ -76,21 +76,17 @@
source = config.source.open()
destination = config.destination.open()
- #write("Storages opened successfully.\n")
log.info("Storages opened successfully.")
if options.dry_run:
- #write("Dry run mode: not changing the destination.\n")
log.info("Dry run mode: not changing the destination.")
if storage_has_data(destination):
- #write("Warning: the destination storage has data\n")
log.warning("The destination storage has data.")
count = 0
for txn in source.iterator():
- write('%s user=%s description=%s\n' % (
+ log.info('%s user=%s description=%s' % (
TimeStamp(txn.tid), txn.user, txn.description))
count += 1
- #write("Would copy %d transactions.\n" % count)
log.info("Would copy %d transactions.", count)
else:
@@ -110,7 +106,6 @@
log.info("Started copying transactions...")
log.info("This will take long...")
- #destination.copyTransactionsFrom(source)
num_txns, size, elapsed = destination.copyTransactionsFrom(source)
log.info("Done copying transactions.")
log.info("Closing up...")
@@ -119,8 +114,6 @@
destination.close()
rate = (size/float(1024*1024)) / elapsed
- #write('All %d transactions copied successfully in %4.1f minutes at %1.3fmB/s.\n' %
- # (num_txns, elapsed/60, rate))
log.info('All %d transactions copied successfully in %4.1f minutes at %1.3fmB/s.',
num_txns, elapsed/60, rate)
More information about the checkins
mailing list