rust-jack icon indicating copy to clipboard operation
rust-jack copied to clipboard

Verbose/debug logging

Open andrewbaxter opened this issue 2 years ago • 2 comments

I'm trying to figure out how this works, between this library, libjack2, and pipewire-jack. Libjack2 logging depends on JackGlobals.fVerbose being truthy.

AFAICT libjack2 connects to the server then sets JackGlobals.fVerbose based on shared memory with the server. I don't see anything in pipewire-jack that looks like shared memory, so I'm not sure how this works. But libjack2 does logging before connecting to the server, so this is moot.

I think doing JackGlobals::fVerbose = 1 is normal and expected. Would it be possible to expose a method to do this somewhere (for pre-connect logging)? I'm not sure if bindgen supports global variable access.

andrewbaxter avatar Nov 26 '23 10:11 andrewbaxter

Adding to bindings

🤔 I have some doubt, but I haven't coded to Jack2 specifically. I thought the JACK API was C and although Jack2 is made in C++ it exposes only the standard C API.

For, if you can do it, maybe if there is a C API. The C bindings have 2 ways of loading the symbols. Dynamic loading (default) and static which is the standard. When using dynamic, we search libjack for the symbol and store it. If the symbol does not exist, then we can panic or return an error.

Logging

Is the problem you are facing that there is not enough logging from JACK? After initializing a JACK client, rust-jack hooks up JACK's info and error callbacks to the standard log crate info! and error! macros.

This happens at https://github.com/RustAudio/rust-jack/blob/main/src/client/client_impl.rs#L64

However, I just noticed that for some reason we silence JACK at the start. Not really why we do this but we should probably not completely silence JACK's logging. We can probably revert this if it works with JACK2 and Pipewire.

Speaking of this, I'll see if I can add Pipewire to GitHub's CI.

wmedrano avatar Sep 12 '24 02:09 wmedrano

Ah thanks! IIRC I hooked up a logger to those macros and still didn't get the logs I was looking for.

I'll add though that I'm not currently working on the project where I initially needed this so I can't help test immediately... I think I ended up figuring out the issue with strace or liberal google searching and maybe some blind trial and error + luck. I'm sure I'll need this again someday in the future though so it'd be good to have.

andrewbaxter avatar Sep 12 '24 09:09 andrewbaxter