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

Log callback API added #194

Merged
merged 1 commit into from Mar 5, 2024
Merged

Log callback API added #194

merged 1 commit into from Mar 5, 2024

Conversation

dmitry-zakablukov
Copy link
Contributor

Good day.

This pr suggests some API updates to support log callbacks.

Log callback setup:

let mut context = rusb::Context::new()?;
context.set_log_level(rusb::LogLevel::Info);

let cb = Box::new(move |level: rusb::LogLevel, text: String| {
    println!(log_file, "[{:#?}] {}", level, text).ok();
});

context.set_log_callback(cb, rusb::LogCallbackMode::Context);

You can take this changes as a base for your own API or just merge it as is.

@a1ien
Copy link
Owner

a1ien commented Mar 5, 2024

Thank you. LGTM.

@a1ien a1ien merged commit 145c12c into a1ien:master Mar 5, 2024
7 of 8 checks passed
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.

None yet

2 participants