From 530394c2c5f50161b53c0185e3f681490c741375 Mon Sep 17 00:00:00 2001 From: Christoph Burandt Date: Thu, 14 Nov 2024 12:27:21 +0100 Subject: [PATCH] Add debug config option and log token discovery only in debug mode --- modules/PN7160TokenProvider/main/auth_token_providerImpl.cpp | 4 +++- modules/PN7160TokenProvider/main/auth_token_providerImpl.hpp | 1 + modules/PN7160TokenProvider/manifest.yaml | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/PN7160TokenProvider/main/auth_token_providerImpl.cpp b/modules/PN7160TokenProvider/main/auth_token_providerImpl.cpp index f7b747f5f..59c8deaeb 100644 --- a/modules/PN7160TokenProvider/main/auth_token_providerImpl.cpp +++ b/modules/PN7160TokenProvider/main/auth_token_providerImpl.cpp @@ -63,7 +63,9 @@ void auth_token_providerImpl::new_rfid_token_callback(char* uid, size_t length, token.id_token.value = rfid_to_string(uid, length); token.authorization_type = types::authorization::AuthorizationType::RFID; - EVLOG_info << "Publishing new rfid/nfc token: " << token; + if (config.debug) { + EVLOG_info << "Publishing new rfid/nfc token: " << token; + } this->publish_provided_token(token); this->last_rfid_submit = now; diff --git a/modules/PN7160TokenProvider/main/auth_token_providerImpl.hpp b/modules/PN7160TokenProvider/main/auth_token_providerImpl.hpp index a2a768725..160b4d047 100644 --- a/modules/PN7160TokenProvider/main/auth_token_providerImpl.hpp +++ b/modules/PN7160TokenProvider/main/auth_token_providerImpl.hpp @@ -23,6 +23,7 @@ namespace main { struct Conf { int token_debounce_interval_ms; bool disable_nfc_rfid; + bool debug; }; class auth_token_providerImpl : public auth_token_providerImplBase { diff --git a/modules/PN7160TokenProvider/manifest.yaml b/modules/PN7160TokenProvider/manifest.yaml index f020e608b..9d64eaeb6 100644 --- a/modules/PN7160TokenProvider/manifest.yaml +++ b/modules/PN7160TokenProvider/manifest.yaml @@ -14,6 +14,10 @@ provides: description: Disable NFC RFID reader type: boolean default: false + debug: + description: Show debug output on command line. + type: boolean + default: false metadata: license: https://opensource.org/licenses/Apache-2.0 authors: