aboutsummaryrefslogtreecommitdiff
path: root/src/message.cpp
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-04-26 11:44:32 +0100
committerRichard van der Hoff <richard@matrix.org>2016-04-26 17:55:26 +0100
commit9848f8445292ad3f7ff92bd4abfeb8f2d08ec32d (patch)
tree36f1f030f71bd16b85e0fe1aa77c42f457a3b168 /src/message.cpp
parente7a2af1ede768589e612bad1c61b10186a1bb686 (diff)
Add some logging to help understand what's going on
Diffstat (limited to 'src/message.cpp')
-rw-r--r--src/message.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/message.cpp b/src/message.cpp
index 05f707f..30abd9c 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -14,8 +14,13 @@
*/
#include "olm/message.hh"
+#include "olm/logging.hh"
+#include "olm/memory.hh"
+
namespace {
+static const char *LOG_CATEGORY = "olm::Message";
+
template<typename T>
static std::size_t varint_length(
T value
@@ -234,6 +239,13 @@ void olm::decode_message(
}
unknown = pos;
}
+ olm::logf(olm::LOG_TRACE, LOG_CATEGORY,
+ "Decoded message ver=%i ratchet_key=%s chain_idx=%i ciphertext=%s",
+ reader.version,
+ olm::bytes_to_string(reader.ratchet_key, reader.ratchet_key_length).c_str(),
+ reader.has_counter ? reader.counter : -1,
+ olm::bytes_to_string(reader.ciphertext, reader.ciphertext_length).c_str()
+ );
}
@@ -322,4 +334,14 @@ void olm::decode_one_time_key_message(
}
unknown = pos;
}
+
+ olm::logf(olm::LOG_TRACE, LOG_CATEGORY,
+ "Decoded pre-key message ver=%i one_time_key[Eb]=%s "
+ "base_key[Ea]=%s identity_key[Ia]=%s message=%s",
+ reader.version,
+ olm::bytes_to_string(reader.one_time_key, reader.one_time_key_length).c_str(),
+ olm::bytes_to_string(reader.base_key, reader.base_key_length).c_str(),
+ olm::bytes_to_string(reader.identity_key, reader.identity_key_length).c_str(),
+ olm::bytes_to_string(reader.message, reader.message_length).c_str()
+ );
}