diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-05 10:06:29 +0100 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-01-05 10:07:29 +0100 |
commit | 5dc71535eaf5810712692d08a5948e74db297ec8 (patch) | |
tree | 03ccd4c6e2bf3896057d7f1a8eaed3feeb757144 /python_bindings_example.py | |
parent | d3d35a3b60b4b41d905821ea4f38b6fcf14ca086 (diff) | |
download | libnitrokey-5dc71535eaf5810712692d08a5948e74db297ec8.tar.gz libnitrokey-5dc71535eaf5810712692d08a5948e74db297ec8.tar.bz2 |
Allow to choose log verbosity level
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'python_bindings_example.py')
-rwxr-xr-x | python_bindings_example.py | 12 |
1 files 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') |