--- a/bin/pvl.backup-rsync Mon Apr 22 00:36:14 2013 +0300
+++ b/bin/pvl.backup-rsync Mon Apr 22 00:36:23 2013 +0300
@@ -11,6 +11,8 @@
sudo sh -c "PYTHONPATH=. rsync -e './bin/pvl.backup-rsync --debug -C --' -ax testing:lvm:asdf:test test/tmp"
"""
+import pvl.args
+
from pvl.backup import __version__
from pvl.backup.rsync import RSyncCommandFormatError
from pvl.backup.invoke import InvokeError
@@ -39,14 +41,7 @@
)
# logging
- general = optparse.OptionGroup(parser, "General Options")
-
- general.add_option('-q', '--quiet', dest='loglevel', action='store_const', const=logging.WARNING, help="Less output")
- general.add_option('-v', '--verbose', dest='loglevel', action='store_const', const=logging.INFO, help="More output")
- general.add_option('-D', '--debug', dest='loglevel', action='store_const', const=logging.DEBUG, help="Even more output")
- general.add_option('--debug-for', action='append', metavar='MODULE', help="Enable logging for the given logger/module name")
-
- parser.add_option_group(general)
+ parser.add_option_group(pvl.args.parser(parser))
#
parser.add_option('-c', '--command', metavar='CMD', default=os.environ.get('SSH_ORIGINAL_COMMAND'),
@@ -82,24 +77,14 @@
# defaults
parser.set_defaults(
- debug_for = [],
- loglevel = logging.INFO,
-
restrict_path = [],
)
# parse
options, args = parser.parse_args(argv[1:])
-
- # configure
- logging.basicConfig(
- format = argv[0] + ': %(levelname)6s %(name)s : %(funcName)s : %(message)s',
- level = options.loglevel,
- )
-
- # enable debugging for specific targets
- for target in options.debug_for :
- logging.getLogger(target).setLevel(logging.DEBUG)
+
+ # general logging/etc
+ pvl.args.apply(options)
return options, args