diff options
| -rw-r--r-- | sokol_audio.h | 15 | ||||
| -rw-r--r-- | util/sokol_spine.h | 15 |
2 files changed, 22 insertions, 8 deletions
diff --git a/sokol_audio.h b/sokol_audio.h index 3ba31714..b97a7766 100644 --- a/sokol_audio.h +++ b/sokol_audio.h @@ -413,8 +413,15 @@ was called, so you don't need to worry about thread-safety. - ERROR REPORTING AND LOGGING OVERRIDE - ==================================== + ERROR REPORTING AND LOGGING + =========================== + To get any logging information at all you need to provide a logging callback in the setup call + the easiest way is to use sokol_log.h: + + #include "sokol_log.h" + + saudio_setup(&(saudio_desc){ .logger.func = slog_func }); + To override logging with your own callback, first write a logging function like this: void my_log(const char* tag, // e.g. 'saudio' @@ -587,7 +594,7 @@ typedef struct saudio_desc { void (*stream_userdata_cb)(float* buffer, int num_frames, int num_channels, void* user_data); //... and with user data void* user_data; // optional user data argument for stream_userdata_cb saudio_allocator allocator; // optional allocation override functions - saudio_logger logger; // optional log override functions + saudio_logger logger; // optional logging function (default: NO LOGGING!) } saudio_desc; /* setup sokol-audio */ @@ -1099,7 +1106,7 @@ _SOKOL_PRIVATE void _saudio_stream_callback(float* buffer, int num_frames, int n static const char* _saudio_log_messages[] = { _SAUDIO_LOG_ITEMS }; -#undef _SSPINE_XMACRO +#undef _SAUDIO_XMACRO #endif // SOKOL_DEBUG #define _SAUDIO_PANIC(code) _saudio_log(SAUDIO_LOGITEM_ ##code, 0, __LINE__) diff --git a/util/sokol_spine.h b/util/sokol_spine.h index fa26167c..e28edcd1 100644 --- a/util/sokol_spine.h +++ b/util/sokol_spine.h @@ -847,8 +847,15 @@ vice versa. - ERROR REPORTING AND LOGGING OVERRIDE - ==================================== + ERROR REPORTING AND LOGGING + =========================== + To get any logging information at all you need to provide a logging callback in the setup call, + the easiest way is to use sokol_log.h: + + #include "sokol_log.h" + + sspine_setup(&(sspine_desc){ .logger.func = slog_func }); + To override logging with your own callback, first write a logging function like this: void my_log(const char* tag, // e.g. 'sspine' @@ -1209,8 +1216,8 @@ typedef struct sspine_desc { sg_pixel_format depth_format; int sample_count; sg_color_mask color_write_mask; - sspine_allocator allocator; - sspine_logger logger; + sspine_allocator allocator; // optional allocation override functions (default: malloc/free) + sspine_logger logger; // optional logging function (default: NO LOGGING!) } sspine_desc; // setup/shutdown |