summaryrefslogtreecommitdiffstats
path: root/src/fedpkg.py
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-01-05 17:06:56 -0800
committerJesse Keating <jkeating@redhat.com>2010-01-05 17:06:56 -0800
commite6c16bfc10aed56318375f43bcf6ad8f9b287407 (patch)
tree73c9ad8617f4280079f77c8c805a699051706e44 /src/fedpkg.py
parentc9b2e75fba78c20524d40badf73caafc6b4b36c4 (diff)
downloadfedora-packager-e6c16bfc10aed56318375f43bcf6ad8f9b287407.tar.gz
fedora-packager-e6c16bfc10aed56318375f43bcf6ad8f9b287407.tar.xz
fedora-packager-e6c16bfc10aed56318375f43bcf6ad8f9b287407.zip
Use the logging system from fedpkg
Adjust the options accordingly too
Diffstat (limited to 'src/fedpkg.py')
-rwxr-xr-xsrc/fedpkg.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index a0d5920..ab1e760 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -14,6 +14,7 @@ import argparse
import fedpkg
import os
import sys
+import logging
# Add a simple function to print usage, for the 'help' command
def usage(args):
@@ -210,8 +211,10 @@ if __name__ == '__main__':
parser.add_argument('--path', default = os.getcwd(),
help='Directory to interact with instead of current dir')
# Verbosity
- parser.add_argument('-v', action = 'count',
- help = 'Verbosity, may be specified multiple times')
+ parser.add_argument('-v', action = 'store_true',
+ help = 'Run with verbose debug output')
+ parser.add_argument('-q', action = 'store_true',
+ help = 'Run quietly only displaying errors')
# Add a subparsers object to use for the actions
subparsers = parser.add_subparsers(title = 'Targets')
@@ -386,6 +389,21 @@ if __name__ == '__main__':
' name-version-release')
parser_verrel.set_defaults(command = verrel)
- # Parse the args and run the necessary command
+ # Parse the args
args = parser.parse_args()
+
+ # setup the logger
+ log = fedpkg.log
+ if args.v:
+ log.setLevel(logging.DEBUG)
+ elif args.q:
+ log.setLevel(logging.WARNING)
+ else:
+ log.setLevel(logging.INFO)
+ streamhandler = logging.StreamHandler()
+ formatter = logging.Formatter('%(message)s')
+ streamhandler.setFormatter(formatter)
+ log.addHandler(streamhandler)
+
+ # Run the necessary command
args.command(args) \ No newline at end of file