summaryrefslogtreecommitdiffstats
path: root/rpmbuild-remote.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpmbuild-remote.py')
-rwxr-xr-xrpmbuild-remote.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/rpmbuild-remote.py b/rpmbuild-remote.py
index 427b1b5..696a21f 100755
--- a/rpmbuild-remote.py
+++ b/rpmbuild-remote.py
@@ -8,8 +8,15 @@ import optparse
import sys
import os
+LOGGING_LEVELS = {
+ 'debug': logging.DEBUG,
+ 'info': logging.INFO,
+ 'warning': logging.WARNING,
+ 'error': logging.ERROR,
+ 'critical': logging.CRITICAL,
+}
+
LOG = logging.getLogger('rpmbuild-remote')
-LOG.addHandler(logging.StreamHandler())
EXTENSIONS = (
'.patch',
@@ -55,6 +62,15 @@ def get_parser():
action="store", type="string", dest="mock",
help="Mock configuration to use (only applies to SRPM files) "
"[Default: Use rpmbuild --rebuild)]")
+ parser.add_option("-v", "--verbose",
+ action="store", type="string", dest="verbose",
+ default="info",
+ help="Error level (debug|info|warning|error|critical) "
+ "[Default: info]")
+ parser.add_option("-o", "--outfile",
+ action="store", type="string", dest="log_file",
+ default=os.path.join(home, "rpmbuild-remote", "log"),
+ help="Log file [Default: ~/rpmbuild-remote/log]")
return parser
def read_section(config, section, values):
@@ -187,6 +203,8 @@ def execute_jobs(opts, system, jobs):
def main():
parser = get_parser()
opts, args = parser.parse_args()
+ log_level = LOGGING_LEVELS.get(opts.verbose, logging.NOTSET)
+ logging.basicConfig(filename=opts.log_file, level=log_level)
jobs = []
for arg in args:
ext = os.path.splitext(arg)[1]