Przeglądaj źródła

simplify logging preprocessor macros

Andre Weissflog 2 lat temu
rodzic
commit
1eebe4c0d7
11 zmienionych plików z 74 dodań i 157 usunięć
  1. 11 24
      sokol_app.h
  2. 1 1
      sokol_args.h
  3. 11 24
      sokol_audio.h
  4. 12 25
      sokol_fetch.h
  5. 11 29
      sokol_gfx.h
  6. 12 25
      util/sokol_debugtext.h
  7. 1 1
      util/sokol_fontstash.h
  8. 12 25
      util/sokol_gl.h
  9. 1 1
      util/sokol_imgui.h
  10. 1 1
      util/sokol_memtrack.h
  11. 1 1
      util/sokol_nuklear.h

+ 11 - 24
sokol_app.h

@@ -1468,7 +1468,7 @@ typedef struct sapp_allocator {
     sapp_logger
     sapp_logger
 
 
     Used in sapp_desc to provide custom log callbacks to sokol_app.h.
     Used in sapp_desc to provide custom log callbacks to sokol_app.h.
-    Default behavior is SAPP_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct sapp_logger {
 typedef struct sapp_logger {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -1799,7 +1799,7 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -1810,32 +1810,19 @@ inline void sapp_run(const sapp_desc& desc) { return sapp_run(&desc); }
     #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
     #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use sg_desc.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #define SAPP_LOG(s) { SOKOL_ASSERT(s); _sapp_log(s); }
-    #ifndef SAPP_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SAPP_LOG(s)
+#else
+    #define SAPP_LOG(s) _sapp_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SAPP_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_APP", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_APP", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SAPP_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SAPP_LOG(s)
-#endif
-#ifndef SAPP_LOG_DEFAULT
-    #define SAPP_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #ifndef SOKOL_ABORT
 #ifndef SOKOL_ABORT
@@ -2787,14 +2774,14 @@ _SOKOL_PRIVATE void _sapp_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 _SOKOL_PRIVATE void _sapp_log(const char* msg) {
 _SOKOL_PRIVATE void _sapp_log(const char* msg) {
     SOKOL_ASSERT(msg);
     SOKOL_ASSERT(msg);
     if (_sapp.desc.logger.log_cb) {
     if (_sapp.desc.logger.log_cb) {
         _sapp.desc.logger.log_cb(msg, _sapp.desc.logger.user_data);
         _sapp.desc.logger.log_cb(msg, _sapp.desc.logger.user_data);
     }
     }
     else {
     else {
-        SAPP_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 1 - 1
sokol_args.h

@@ -373,7 +373,7 @@ inline void sargs_setup(const sargs_desc& desc) { return sargs_setup(&desc); }
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT

+ 11 - 24
sokol_audio.h

@@ -484,7 +484,7 @@ typedef struct saudio_allocator {
     saudio_logger
     saudio_logger
 
 
     Used in saudio_desc to provide custom log callbacks to sokol_audio.h.
     Used in saudio_desc to provide custom log callbacks to sokol_audio.h.
-    Default behavior is SAUDIO_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct saudio_logger {
 typedef struct saudio_logger {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -553,7 +553,7 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -561,32 +561,19 @@ inline void saudio_setup(const saudio_desc& desc) { return saudio_setup(&desc);
     #define SOKOL_ASSERT(c) assert(c)
     #define SOKOL_ASSERT(c) assert(c)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use saudio_desc.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #define SAUDIO_LOG(s) { SOKOL_ASSERT(s); _saudio_log(s); }
-    #ifndef SAUDIO_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SAUDIO_LOG(s)
+#else
+    #define SAUDIO_LOG(s) _saudio_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SAUDIO_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_AUDIO", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_AUDIO", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SAUDIO_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SAUDIO_LOG(s)
-#endif
-#ifndef SAUDIO_LOG_DEFAULT
-    #define SAUDIO_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #ifndef _SOKOL_PRIVATE
 #ifndef _SOKOL_PRIVATE
@@ -1037,13 +1024,13 @@ _SOKOL_PRIVATE void _saudio_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 _SOKOL_PRIVATE void _saudio_log(const char* msg) {
 _SOKOL_PRIVATE void _saudio_log(const char* msg) {
     SOKOL_ASSERT(msg);
     SOKOL_ASSERT(msg);
     if (_saudio.desc.logger.log_cb) {
     if (_saudio.desc.logger.log_cb) {
         _saudio.desc.logger.log_cb(msg, _saudio.desc.logger.user_data);
         _saudio.desc.logger.log_cb(msg, _saudio.desc.logger.user_data);
     } else {
     } else {
-        SAUDIO_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 12 - 25
sokol_fetch.h

@@ -928,7 +928,7 @@ typedef struct sfetch_allocator_t {
     sfetch_logger_t
     sfetch_logger_t
 
 
     Used in sfetch_desc_t to provide custom log callbacks to sokol_fetch.h.
     Used in sfetch_desc_t to provide custom log callbacks to sokol_fetch.h.
-    Default behavior is SFETCH_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct sfetch_logger_t {
 typedef struct sfetch_logger_t {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -941,7 +941,7 @@ typedef struct sfetch_desc_t {
     uint32_t num_channels;          /* number of channels to fetch requests in parallel (default: 1) */
     uint32_t num_channels;          /* number of channels to fetch requests in parallel (default: 1) */
     uint32_t num_lanes;             /* max number of requests active on the same channel (default: 1) */
     uint32_t num_lanes;             /* max number of requests active on the same channel (default: 1) */
     sfetch_allocator_t allocator;   /* optional memory allocation overrides (default: malloc/free) */
     sfetch_allocator_t allocator;   /* optional memory allocation overrides (default: malloc/free) */
-    sfetch_logger_t logger;         /* optional log function overrides (default: SFETCH_LOG_DEFAULT(message)) */
+    sfetch_logger_t logger;         /* optional log function overrides (default: SOKOL_LOG(message)) */
 } sfetch_desc_t;
 } sfetch_desc_t;
 
 
 /* a request handle to identify an active fetch request, returned by sfetch_send() */
 /* a request handle to identify an active fetch request, returned by sfetch_send() */
@@ -1060,7 +1060,7 @@ inline sfetch_handle_t sfetch_send(const sfetch_request_t& request) { return sfe
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -1068,32 +1068,19 @@ inline sfetch_handle_t sfetch_send(const sfetch_request_t& request) { return sfe
     #define SOKOL_ASSERT(c) assert(c)
     #define SOKOL_ASSERT(c) assert(c)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use sfetch_desc.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #define SFETCH_LOG(s) { SOKOL_ASSERT(s); _sfetch_log(s); }
-    #ifndef SFETCH_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SFETCH_LOG(s)
+#else
+    #define SFETCH_LOG(s) _sfetch_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SFETCH_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_FETCH", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_FETCH", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SFETCH_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SFETCH_LOG(s)
-#endif
-#ifndef SFETCH_LOG_DEFAULT
-    #define SFETCH_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #ifndef _SOKOL_PRIVATE
 #ifndef _SOKOL_PRIVATE
@@ -1340,13 +1327,13 @@ _SOKOL_PRIVATE void _sfetch_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 _SOKOL_PRIVATE void _sfetch_log(const char* msg) {
 _SOKOL_PRIVATE void _sfetch_log(const char* msg) {
     if (_sfetch->desc.logger.log_cb) {
     if (_sfetch->desc.logger.log_cb) {
         _sfetch->desc.logger.log_cb(msg, _sfetch->desc.logger.user_data);
         _sfetch->desc.logger.log_cb(msg, _sfetch->desc.logger.user_data);
     }
     }
     else {
     else {
-        SFETCH_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 11 - 29
sokol_gfx.h

@@ -2478,7 +2478,7 @@ typedef struct sg_allocator {
     sg_logger
     sg_logger
 
 
     Used in sg_desc to provide custom log callbacks to sokol_gfx.h.
     Used in sg_desc to provide custom log callbacks to sokol_gfx.h.
-    Default behavior is SG_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct sg_logger {
 typedef struct sg_logger {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -2671,7 +2671,7 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -2691,37 +2691,19 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_
     #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
     #define SOKOL_UNREACHABLE SOKOL_ASSERT(false)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use sg_desc.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #if defined(__ANDROID__)
-        #include <android/log.h> // __android_log_write
-    #else
-        #include <stdio.h> // puts
-    #endif
-    #define SG_LOG(s) { SOKOL_ASSERT(s); _sg_log(s); }
-    #ifndef SG_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SG_LOG(s)
+#else
+    #define SG_LOG(s) _sg_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SG_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_GFX", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_GFX", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SG_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SG_LOG(s)
-#endif
-#ifndef SG_LOG_DEFAULT
-    #define SG_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #ifndef _SOKOL_PRIVATE
 #ifndef _SOKOL_PRIVATE
@@ -4380,13 +4362,13 @@ _SOKOL_PRIVATE void _sg_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 _SOKOL_PRIVATE void _sg_log(const char* msg) {
 _SOKOL_PRIVATE void _sg_log(const char* msg) {
     SOKOL_ASSERT(msg);
     SOKOL_ASSERT(msg);
     if (_sg.desc.logger.log_cb) {
     if (_sg.desc.logger.log_cb) {
         _sg.desc.logger.log_cb(msg, _sg.desc.logger.user_data);
         _sg.desc.logger.log_cb(msg, _sg.desc.logger.user_data);
     } else {
     } else {
-        SG_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 12 - 25
util/sokol_debugtext.h

@@ -567,7 +567,7 @@ typedef struct sdtx_allocator_t {
     sdtx_logger_t
     sdtx_logger_t
 
 
     Used in sdtx_desc_t to provide custom log callbacks to sokol_debugtext.h.
     Used in sdtx_desc_t to provide custom log callbacks to sokol_debugtext.h.
-    Default behavior is SDTX_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct sdtx_logger_t {
 typedef struct sdtx_logger_t {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -596,7 +596,7 @@ typedef struct sdtx_desc_t {
     sdtx_font_desc_t fonts[SDTX_MAX_FONTS]; // up to 8 fonts descriptions
     sdtx_font_desc_t fonts[SDTX_MAX_FONTS]; // up to 8 fonts descriptions
     sdtx_context_desc_t context;            // the default context creation parameters
     sdtx_context_desc_t context;            // the default context creation parameters
     sdtx_allocator_t allocator;             // optional memory allocation overrides (default: malloc/free)
     sdtx_allocator_t allocator;             // optional memory allocation overrides (default: malloc/free)
-    sdtx_logger_t logger;                   // optional log override functions (default: SDTX_LOG_DEFAULT(message))
+    sdtx_logger_t logger;                   // optional log override functions (default: SOKOL_LOG(message))
 } sdtx_desc_t;
 } sdtx_desc_t;
 
 
 /* initialization/shutdown */
 /* initialization/shutdown */
@@ -680,7 +680,7 @@ inline sdtx_context sdtx_make_context(const sdtx_context_desc_t& desc) { return
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -688,32 +688,19 @@ inline sdtx_context sdtx_make_context(const sdtx_context_desc_t& desc) { return
     #define SOKOL_ASSERT(c) assert(c)
     #define SOKOL_ASSERT(c) assert(c)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use sg_desc.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #define SDTX_LOG(s) { SOKOL_ASSERT(s); _sdtx_log(s); }
-    #ifndef SDTX_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SDTX_LOG(s)
+#else
+    #define SDTX_LOG(s) _sdtx_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SDTX_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_DEBUGTEXT", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_DEBUGTEXT", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SDTX_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SDTX_LOG(s)
-#endif
-#ifndef SDTX_LOG_DEFAULT
-    #define SDTX_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #ifndef SOKOL_UNREACHABLE
 #ifndef SOKOL_UNREACHABLE
@@ -3563,13 +3550,13 @@ static void _sdtx_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 static void _sdtx_log(const char* msg) {
 static void _sdtx_log(const char* msg) {
     SOKOL_ASSERT(msg);
     SOKOL_ASSERT(msg);
     if (_sdtx.desc.logger.log_cb) {
     if (_sdtx.desc.logger.log_cb) {
         _sdtx.desc.logger.log_cb(msg, _sdtx.desc.logger.user_data);
         _sdtx.desc.logger.log_cb(msg, _sdtx.desc.logger.user_data);
     } else {
     } else {
-        SDTX_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 1 - 1
util/sokol_fontstash.h

@@ -265,7 +265,7 @@ SOKOL_FONTSTASH_API_DECL uint32_t sfons_rgba(uint8_t r, uint8_t g, uint8_t b, ui
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT

+ 12 - 25
util/sokol_gl.h

@@ -700,7 +700,7 @@ typedef struct sgl_allocator_t {
     sgl_logger_t
     sgl_logger_t
 
 
     Used in sgl_desc_t to provide custom log callbacks to sokol_gl.h.
     Used in sgl_desc_t to provide custom log callbacks to sokol_gl.h.
-    Default behavior is SGL_LOG_DEFAULT(message).
+    Default behavior is SOKOL_LOG(message).
 */
 */
 typedef struct sgl_logger_t {
 typedef struct sgl_logger_t {
     void (*log_cb)(const char* message, void* user_data);
     void (*log_cb)(const char* message, void* user_data);
@@ -717,7 +717,7 @@ typedef struct sgl_desc_t {
     int sample_count;
     int sample_count;
     sg_face_winding face_winding;   // default: SG_FACEWINDING_CCW
     sg_face_winding face_winding;   // default: SG_FACEWINDING_CCW
     sgl_allocator_t allocator;      // optional memory allocation overrides (default: malloc/free)
     sgl_allocator_t allocator;      // optional memory allocation overrides (default: malloc/free)
-    sgl_logger_t logger;            // optional memory allocation overrides (default: SGL_LOG_DEFAULT(message))
+    sgl_logger_t logger;            // optional memory allocation overrides (default: SOKOL_LOG(message))
 } sgl_desc_t;
 } sgl_desc_t;
 
 
 /* the default context handle */
 /* the default context handle */
@@ -856,7 +856,7 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT
@@ -864,32 +864,19 @@ inline sgl_pipeline sgl_context_make_pipeline(sgl_context ctx, const sg_pipeline
     #define SOKOL_ASSERT(c) assert(c)
     #define SOKOL_ASSERT(c) assert(c)
 #endif
 #endif
 
 
-#if defined(SOKOL_LOG)
-#error "SOKOL_LOG macro is no longer supported, please use sgl_desc_t.logger to override log functions"
-#endif
-#ifndef SOKOL_NO_LOG
-    #ifdef SOKOL_DEBUG
-        #define SOKOL_NO_LOG 0
-    #else
-        #define SOKOL_NO_LOG 1
-    #endif
-#endif
-#if !SOKOL_NO_LOG
-    #define SGL_LOG(s) { SOKOL_ASSERT(s); _sgl_log(s); }
-    #ifndef SGL_LOG_DEFAULT
+#if !defined(SOKOL_DEBUG)
+    #define SGL_LOG(s)
+#else
+    #define SGL_LOG(s) _sgl_log(s)
+    #ifndef SOKOL_LOG
         #if defined(__ANDROID__)
         #if defined(__ANDROID__)
             #include <android/log.h>
             #include <android/log.h>
-            #define SGL_LOG_DEFAULT(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_GL", s)
+            #define SOKOL_LOG(s) __android_log_write(ANDROID_LOG_INFO, "SOKOL_GL", s)
         #else
         #else
             #include <stdio.h>
             #include <stdio.h>
-            #define SGL_LOG_DEFAULT(s) puts(s)
+            #define SOKOL_LOG(s) puts(s)
         #endif
         #endif
     #endif
     #endif
-#else
-    #define SGL_LOG(s)
-#endif
-#ifndef SGL_LOG_DEFAULT
-    #define SGL_LOG_DEFAULT(s)
 #endif
 #endif
 
 
 #define _sgl_def(val, def) (((val) == 0) ? (def) : (val))
 #define _sgl_def(val, def) (((val) == 0) ? (def) : (val))
@@ -2390,13 +2377,13 @@ static void _sgl_free(void* ptr) {
     }
     }
 }
 }
 
 
-#if !SOKOL_NO_LOG
+#if defined(SOKOL_DEBUG)
 static void _sgl_log(const char* msg) {
 static void _sgl_log(const char* msg) {
     SOKOL_ASSERT(msg);
     SOKOL_ASSERT(msg);
     if (_sgl.desc.logger.log_cb) {
     if (_sgl.desc.logger.log_cb) {
         _sgl.desc.logger.log_cb(msg, _sgl.desc.logger.user_data);
         _sgl.desc.logger.log_cb(msg, _sgl.desc.logger.user_data);
     } else {
     } else {
-        SGL_LOG_DEFAULT(msg);
+        SOKOL_LOG(msg);
     }
     }
 }
 }
 #endif
 #endif

+ 1 - 1
util/sokol_imgui.h

@@ -379,7 +379,7 @@ inline void simgui_new_frame(const simgui_frame_desc_t& desc) { return simgui_ne
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT

+ 1 - 1
util/sokol_memtrack.h

@@ -115,7 +115,7 @@ SOKOL_MEMTRACK_API_DECL void smemtrack_free(void* ptr, void* user_data);
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef _SOKOL_PRIVATE
 #ifndef _SOKOL_PRIVATE

+ 1 - 1
util/sokol_nuklear.h

@@ -267,7 +267,7 @@ inline void snk_setup(const snk_desc_t& desc) { return snk_setup(&desc); }
 #endif
 #endif
 #ifndef SOKOL_DEBUG
 #ifndef SOKOL_DEBUG
     #ifndef NDEBUG
     #ifndef NDEBUG
-        #define SOKOL_DEBUG (1)
+        #define SOKOL_DEBUG
     #endif
     #endif
 #endif
 #endif
 #ifndef SOKOL_ASSERT
 #ifndef SOKOL_ASSERT