Skip to content

feat(runtime): add log level set/get for pdk control #758

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

Merged
merged 2 commits into from
Aug 28, 2024
Merged

Conversation

nilslice
Copy link
Member

@nilslice nilslice commented Aug 27, 2024

In addition to this change, @zshipko is looking into if we need to extract basic log level info from the more complex filter string, and how to require tracing compatibility to at least set some level (or to work when there is no level set thus ignoring all logs)

For other runtimes, there is still an equivalent implementation for get_log_level() -> I32 in Go and JS, as well as the ability to set the log level for the host, which is then loaded when get_log_level is called.

TODO:

@nilslice
Copy link
Member Author

@zshipko thank you for the follow up commit. I am doing a quick spike on the Go SDK implementation to see if there is any complexity as far as consistency to this impl goes.

Will update here and we can merge this after that.

@nilslice
Copy link
Member Author

Ok, there's a tiny bit of complexity 😆, but no more than to be expected... LGTM!

@nilslice nilslice merged commit b6e1caa into main Aug 28, 2024
5 checks passed
@nilslice nilslice deleted the log-level-state branch August 28, 2024 20:31
nilslice added a commit to extism/go-sdk that referenced this pull request Sep 16, 2024
#74)

This PR aligns the extism host env with Rust, as per
extism/extism#758

NOTE of breaking change:

I've removed the ability to set the log level on the `*Plugin` itself.
To align with Rust SDK, this is only an SDK-global setting. You can
still add a custom logger to each plugin function. The SDK won't print
any logs unless there is a log function set for each plugin. The global
setting is in line with how libraries are expected to respect the main
application's log level.
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