-
Notifications
You must be signed in to change notification settings - Fork 130
[bindings] Enhancement: add an optional logging callback to demi_args_t #1535
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
base: dev
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the bindings by adding an optional logging callback to demi_args_t, allowing log messages to be routed to a caller-specified C callback rather than stdout.
- Updated the sizes macro in tests/c/sizes.c to account for the new logging callback field.
- Added demi_log_callback_t and updated demi_args_t in src/rust/runtime/types/mod.rs.
- Extended logging initialization in src/rust/runtime/logging.rs and demi_init in src/rust/demikernel/bindings.rs to support the new callback.
- Updated the C header in include/demi/types.h to include the new logging callback type and related enum values.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/c/sizes.c | Updated DEMI_ARGS_SIZE macro, now adding the callback size twice. |
src/rust/runtime/types/mod.rs | Added a new logging callback type and a field in demi_args_t. |
src/rust/runtime/logging.rs | Implemented a new LogWriter that routes logs to the C callback. |
src/rust/demikernel/bindings.rs | Modified demi_init to call custom_initialize when a callback is provided. |
include/demi/types.h | Added enum and typedef for the logging callback. |
4d5a585
to
e5cea45
Compare
libos = catpowder
|
libos = catnip
|
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.
This looks great. thanks for doing it.
This PR adds a callback function to
demi_args_t
. If specified by the caller, it will be invoked by flexi_logger for all logging calls, as oppose to printing to stdout.