summaryrefslogtreecommitdiffstats
path: root/rpmbuild-remote.py
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-09-09 13:50:12 -0400
committerBen Boeckel <MathStuf@gmail.com>2009-09-09 13:50:12 -0400
commitf9129c3b936203cc82544fb09d94ccaa14db3d3c (patch)
tree3dd856645cc006361d9b26ebfaaca523db51db98 /rpmbuild-remote.py
parent0677427e087b04c0dd9cb642674bef9c3b922437 (diff)
downloadrpmbuild-remote-f9129c3b936203cc82544fb09d94ccaa14db3d3c.zip
rpmbuild-remote-f9129c3b936203cc82544fb09d94ccaa14db3d3c.tar.gz
rpmbuild-remote-f9129c3b936203cc82544fb09d94ccaa14db3d3c.tar.xz
Add logging options
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]