[gnome-keysign: 4/5] sign-key: offer a verbosity switch for running the program
- From: Tobias Mueller <tobiasmue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keysign: 4/5] sign-key: offer a verbosity switch for running the program
- Date: Mon, 2 Sep 2019 10:35:13 +0000 (UTC)
commit 61fb65bc3e1df17b1125913eee6d536a28b472b0
Author: Tobias Mueller <muelli cryptobitch de>
Date: Mon Sep 2 12:34:18 2019 +0200
sign-key: offer a verbosity switch for running the program
When running the sign-key script, we might want to have more debugging
output. This change brings a lightweight way to modify the log level.
keysign/SignKey.py | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/keysign/SignKey.py b/keysign/SignKey.py
index cc14c96..f37da8e 100755
--- a/keysign/SignKey.py
+++ b/keysign/SignKey.py
@@ -28,10 +28,16 @@ if sys.version_info.major < 3:
def main():
import argparse
parser = argparse.ArgumentParser(description="Sign an OpenPGP key from a file. The program will open
each file, exrtact exactly one OpenPGP key, sign each UID separately, encrypt and send each signed UID using
xdg-email.")
+ parser.add_argument('-v', '--verbose', action='count', default=0,
+ help="Increase detail of logging")
parser.add_argument("file", nargs='+', type=argparse.FileType('rb'),
help="File containing OpenPGP keys")
args = parser.parse_args()
+ log_levels = [logging.WARNING, logging.INFO, logging.DEBUG]
+ log_level = log_levels[min(len(log_levels)-1, args.verbose)]
+ logging.basicConfig(level=log_level)
+
log = logging.getLogger(__name__)
log.debug('Running main with args: %s', args)
for fhandle in args.file:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]