1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-06 20:56:43 +03:00

Ostream operator for key type for better readability.

This commit is contained in:
Teemu Ollakka
2020-10-19 05:31:20 +03:00
parent 04944b4d10
commit ec767cd3f0
3 changed files with 16 additions and 1 deletions

View File

@ -89,6 +89,7 @@ namespace wsrep
typedef std::vector<wsrep::key> key_array; typedef std::vector<wsrep::key> key_array;
std::ostream& operator<<(std::ostream&, enum wsrep::key::type);
std::ostream& operator<<(std::ostream&, const wsrep::key&); std::ostream& operator<<(std::ostream&, const wsrep::key&);
} }

View File

@ -39,6 +39,20 @@ namespace
} }
} }
std::ostream& wsrep::operator<<(std::ostream& os,
enum wsrep::key::type key_type)
{
switch (key_type)
{
case wsrep::key::shared: os << "shared"; break;
case wsrep::key::reference: os << "reference"; break;
case wsrep::key::update: os << "update"; break;
case wsrep::key::exclusive: os << "exclusive"; break;
default: os << "unknown"; break;
}
return os;
}
std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::key& key) std::ostream& wsrep::operator<<(std::ostream& os, const wsrep::key& key)
{ {
os << "type: " << key.type(); os << "type: " << key.type();

View File

@ -1821,5 +1821,5 @@ void wsrep::transaction::debug_log_key_append(const wsrep::key& key) const
"key_append: " "key_append: "
<< "trx_id: " << "trx_id: "
<< int64_t(id().get()) << int64_t(id().get())
<< " append key: " << key); << " append key:\n" << key);
} }