Skip to content

Log API #624

Answered by mackron
Stable-Adrian asked this question in Q&A
Discussion options

You must be logged in to vote

It's not complicated. Just register your callback against a ma_log object. You can retrieve the log of a device with ma_device_get_log().

ma_log_register_callback(ma_device_get_log(pDevice), ma_log_callback_init(ma_log_callback, NULL));

If you want to manage your own log object, just pass it into the context config:

ma_log log;
ma_log_init(NULL, &log);
ma_log_register_callback(&log, ma_log_callback_init(my_log, NULL));

// ... initialize your context config ...
contextConfig.pLog = &log;

Make sure you keep the log object alive for the life of the context.

Moving this to the discussion section.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Stable-Adrian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #623 on January 30, 2023 11:44.