Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions plugins/test/framework.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ uint64_t TestContext::getMonotonicTimeNanoseconds() {
return absl::ToUnixNanos(options().clock_time);
}
proxy_wasm::WasmResult TestContext::log(uint32_t log_level,
std::string_view message) {
std::string_view message) {
logging_bytes_ += message.size();
if (wasmVm()->cmpLogLevel(proxy_wasm::LogLevel::trace)) {
std::cout << "TRACE from testcontext: [log] " << message << std::endl;
std::cout << "TRACE from integration: [vm->host] env.proxy_log("
<< log_level << ", "
<< reinterpret_cast<uint64_t>(message.data()) << ", "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful it is to display the address and size of the message string, given that the value of the string is already output. Did you have a case in mind where this information would be valuable?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly ping on this PR. I had a use for it today (testing/inspecting a plugin I did not write and trying to understand its behaviors).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be usefull especially in scenarios where memory management issues may arise, but I don't have a case in mind yet. @martijneken do you think the current modifications would bring additional benefits this way? thanks!

<< message.size() << ") \""
<< message << "\"" << std::endl;
}
if (wasmVm()->cmpLogLevel(static_cast<proxy_wasm::LogLevel>(log_level))) {
phase_logs_.emplace_back(message);
Expand Down