From 5dc71535eaf5810712692d08a5948e74db297ec8 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Fri, 5 Jan 2018 10:06:29 +0100 Subject: Allow to choose log verbosity level Signed-off-by: Szczepan Zalega --- python_bindings_example.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/python_bindings_example.py b/python_bindings_example.py index 7911846..6f1e56d 100755 --- a/python_bindings_example.py +++ b/python_bindings_example.py @@ -82,9 +82,17 @@ if not a == 'continue': ADMIN = raw_input('Please enter your admin PIN (empty string uses 12345678) ') ADMIN = ADMIN or '12345678' # use default if empty string -show_log = raw_input('Should log messages be shown (please write "yes" to enable)? ') == 'yes' +show_log = raw_input('Should log messages be shown (please write "yes" to enable; this will make harder reading script output) ') == 'yes' libnitrokey = get_library() -libnitrokey.NK_set_debug(show_log) # do not show debug messages + +if show_log: + log_level = raw_input('Please select verbosity level (0-5, 2 is library default, 3 will be selected on empty input) ') + log_level = log_level or '3' + log_level = int(log_level) + libnitrokey.NK_set_debug_level(log_level) +else: + libnitrokey.NK_set_debug_level(2) + ADMIN_TEMP = '123123123' RFC_SECRET = to_hex('12345678901234567890') -- cgit v1.2.3