mdbx-test: add log_pair() (minor).

Change-Id: Ifdb762e79b14df0608b5b298941114ada4bc0095
This commit is contained in:
Leonid Yuriev 2020-10-24 20:53:52 +03:00
parent 31857210c5
commit 73c2e5355f
2 changed files with 15 additions and 7 deletions

View File

@ -187,13 +187,7 @@ void __hot maker::pair(serial_t serial, const buffer &key, buffer &value,
mk_continue(key_serial, key_essentials, *key);
mk_continue(value_serial, value_essentials, *value);
if (log_enabled(logging::trace)) {
char dump_key[4096], dump_value[4096];
log_trace("keygen-pair: key %s, value %s",
mdbx_dump_val(&key->value, dump_key, sizeof(dump_key)),
mdbx_dump_val(&value->value, dump_value, sizeof(dump_value)));
}
log_pair(logging::trace, "kv", key, value);
}
void maker::setup(const config::actor_params_pod &actor, unsigned actor_id,
@ -368,4 +362,15 @@ void __hot maker::mk_continue(const serial_t serial, const essentials &params,
out.bytes + out.limit);
}
void log_pair(logging::loglevel level, const char *prefix, const buffer &key,
buffer &value) {
if (log_enabled(level)) {
char dump_key[4096], dump_value[4096];
logging::output(
level, "%s-pair: key %s, value %s", prefix,
mdbx_dump_val(&key->value, dump_key, sizeof(dump_key)),
mdbx_dump_val(&value->value, dump_value, sizeof(dump_value)));
}
}
} /* namespace keygen */

View File

@ -133,4 +133,7 @@ public:
bool increment(serial_t &serial, int delta) const;
};
void log_pair(logging::loglevel level, const char *prefix, const buffer &key,
buffer &value);
} /* namespace keygen */