Updated GB_set_log_callback (markdown)

Lior Halphon 2024-11-30 18:22:11 +02:00
parent b18a4716d9
commit 6b8fab9fd9
1 changed files with 9 additions and 5 deletions

@ -1,17 +1,21 @@
## Definition ## Definition
```c <tt>typedef void (*GB_log_callback_t)([[GB_gameboy_t]] *gb, const char *string, [[GB_log_attributes_t]] attributes);</tt>
typedef void (*GB_log_callback_t)(GB_gameboy_t *gb, const char *string, GB_log_attributes_t attributes);
```
<tt>void GB_set_log_callback([[GB_gameboy_t]] *gb, [[GB_log_callback_t]] callback);</tt> <tt>void GB_set_log_callback([[GB_gameboy_t]] *gb, GB_log_callback_t callback);</tt>
In `gb.h` In `gb.h`
## Description ## Description
TBD Sets a callback that will be called whenever the emulator instance wants to output information such as errors, warnings and debugger output. Logs are formatted, and each `string` is accompanied with a bitfield of [[attributes|GB_log_attributes_t]] determining its visual style. Do not implicitly add new lines (`'\n'`) after `string`, `string` will include a `'\n'` suffix if and only if it's required.
## Thread Safety ## Thread Safety
If `callback` is not NULL, `GB_set_log_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback). If `callback` is not NULL, `GB_set_log_callback` is thread-safe and can be called from any thread and context. Otherwise, it must not be called if the instance is being run in another thread, but may be called from the current one (via a callback).
## See Also
* [[GB_log_attributes_t]]
* [[GB_log]]
* [[GB_attributed_log]]