diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-12 20:44:42 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-12 20:59:34 +0200 |
commit | cc71df8100b33904d2c12a92fef237bebacbe1cd (patch) | |
tree | 9ebf7952d6f638e361169172d2041744888e0509 /NitrokeyManager.cc | |
parent | ebfcff1730b5db2ad85ad47c4ac3963581ef43ba (diff) | |
download | libnitrokey-cc71df8100b33904d2c12a92fef237bebacbe1cd.tar.gz libnitrokey-cc71df8100b33904d2c12a92fef237bebacbe1cd.tar.bz2 |
Refactor log code
Inverse log levels order.
Allow to change logging level with int.
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r-- | NitrokeyManager.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index 9fbd303..096a8c4 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -187,6 +187,12 @@ char * strndup(const char* str, size_t maxlen){ return false; } + void NitrokeyManager::set_loglevel(int loglevel) { + loglevel = max(loglevel, static_cast<int>(Loglevel::ERROR)); + loglevel = min(loglevel, static_cast<int>(Loglevel::DEBUG_L2)); + Log::instance().set_loglevel(static_cast<Loglevel>(loglevel)); + } + void NitrokeyManager::set_loglevel(Loglevel loglevel) { Log::instance().set_loglevel(loglevel); } |