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 #76

Closed
wants to merge 1 commit into from
Closed

Log callback API added #76

wants to merge 1 commit into from

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.

@Cryolitia
Copy link

I would like to see this PR merged, what block it?

@a1ien
Copy link
Owner

a1ien commented Feb 27, 2024

The branch has conflict. Need to rebase, Also std::sync::OnceLock should be used instead of lazy_static

@dmitry-zakablukov
Copy link
Contributor Author

@Cryolitia , @a1ien , opened new pr #194 , this pr will be closed.

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.

3 participants