diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-09-24 22:19:48 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-09-24 22:19:49 +0200 |
commit | 59024a9e889897faf34c03961ead49e32ec1e92b (patch) | |
tree | 7c6e03ce2a27685b09bf65a06536113d954b574e /src/device/log.cpp | |
parent | Merge pull request #4429 (diff) | |
parent | Replace USB-CCID (smartcard) by USB-HID (diff) | |
download | monero-59024a9e889897faf34c03961ead49e32ec1e92b.tar.xz |
Merge pull request #4203
bb6e3bbc Replace USB-CCID (smartcard) by USB-HID (cslashm)
Diffstat (limited to 'src/device/log.cpp')
-rw-r--r-- | src/device/log.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/device/log.cpp b/src/device/log.cpp index 1707524fb..c9d3b551b 100644 --- a/src/device/log.cpp +++ b/src/device/log.cpp @@ -32,29 +32,34 @@ namespace hw { - #ifdef WITH_DEVICE_LEDGER - namespace ledger { - - #undef MONERO_DEFAULT_LOG_CATEGORY - #define MONERO_DEFAULT_LOG_CATEGORY "device.ledger" + #undef MONERO_DEFAULT_LOG_CATEGORY + #define MONERO_DEFAULT_LOG_CATEGORY "device" - void buffer_to_str(char *to_buff, size_t to_len, const char *buff, size_t len) { - CHECK_AND_ASSERT_THROW_MES(to_len > (len*2), "destination buffer too short. At least" << (len*2+1) << " bytes required"); - for (size_t i=0; i<len; i++) { - sprintf(to_buff+2*i, "%.02x", (unsigned char)buff[i]); - } + void buffer_to_str(char *to_buff, size_t to_len, const char *buff, size_t len) { + CHECK_AND_ASSERT_THROW_MES(to_len > (len*2), "destination buffer too short. At least" << (len*2+1) << " bytes required"); + for (size_t i=0; i<len; i++) { + sprintf(to_buff+2*i, "%.02x", (unsigned char)buff[i]); } + } - void log_hexbuffer(const std::string &msg, const char* buff, size_t len) { - char logstr[1025]; - buffer_to_str(logstr, sizeof(logstr), buff, len); - MDEBUG(msg<< ": " << logstr); - } + void log_hexbuffer(const std::string &msg, const char* buff, size_t len) { + char logstr[1025]; + buffer_to_str(logstr, sizeof(logstr), buff, len); + MDEBUG(msg<< ": " << logstr); + } - void log_message(const std::string &msg, const std::string &info ) { - MDEBUG(msg << ": " << info); - } + void log_message(const std::string &msg, const std::string &info ) { + MDEBUG(msg << ": " << info); + } + + + #ifdef WITH_DEVICE_LEDGER + namespace ledger { + + #undef MONERO_DEFAULT_LOG_CATEGORY + #define MONERO_DEFAULT_LOG_CATEGORY "device.ledger" + #ifdef DEBUG_HWDEVICE extern crypto::secret_key dbg_viewkey; extern crypto::secret_key dbg_spendkey; |