-
Notifications
You must be signed in to change notification settings - Fork 70
Add implementation for new ABI proxy_log_destination #336
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Add implementation for new ABI proxy_log_destination #336
Conversation
Signed-off-by: Vikas Choudhary <choudharyvikas16@gmail.com>
c002720
to
4c28647
Compare
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); |
There was a problem hiding this comment.
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());
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. thanks for catching
Signed-off-by: Vikas Choudhary <choudharyvikas16@gmail.com>
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