Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add implementation for new ABI proxy_log_destination #336

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

vikaschoudhary16
Copy link

@vikaschoudhary16 vikaschoudhary16 commented Mar 27, 2023

Implements proxy-wasm/spec#38.

@PiotrSikora @mathetake @anuraaga please see if going in right direction overall. Will add unit tests once confirmed.
I have tested the changes manually. Related changes in envoy, envoyproxy/envoy#26364

xref: envoyproxy/envoy#22669

src/exports.cc Outdated
if (e.first == dest.value()) {
// write message to the file which is the value of the key if it exists
std::ofstream log_file;
log_file.open(e.second, std::ios::out | std::ios_base::app);
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, this should be done on the proxy-side, so that it can use optimized logging facilities (if they exist), work with sandboxing, etc.

Basically, this whole block could be replaced with:

context->log_with_destination(level, message.value(), dest.value());

Copy link
Author

Choose a reason for hiding this comment

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

updated, thanks!

src/exports.cc Outdated
if (!dest) {
return WasmResult::InvalidMemoryAccess;
}
context->log(level, dest.value());
Copy link
Member

Choose a reason for hiding this comment

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

Debug leftover?

Copy link
Author

Choose a reason for hiding this comment

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

yes. thanks for catching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants