floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
6.63k stars 472 forks source link

call _SG_ERROR/_SG_WARN *after* _SG_LOGMSG #900

Closed danielchasehooper closed 10 months ago

danielchasehooper commented 10 months ago

call _SG_ERROR/_SG_WARN after _SG_LOGMSG so that if the logging callback panics on errors/warnings, the log message will have made it to the console before the panic. Really helps with debugging.

floooh commented 10 months ago

Hmm, the original behaviour is actually intended. Both errors and warnings are not supposed to terminate execution, only the panic log level.

For instance, in the validation layer, there's a single panic at the end if any validation had failed (and before that the validation layer may output multiple error log messages):

https://github.com/floooh/sokol/blob/b803c9a0214c6ab6dcb9cc6dd9d30d7ace4eda1e/sokol_gfx.h#L14653-L14658

danielchasehooper commented 10 months ago

My apologies, I thought it was expected that errors would cause an abort. I misread the sokol_log implementation.