sdl_log.odin 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package sdl2
  2. import "core:c"
  3. when ODIN_OS == .Windows {
  4. @(ignore_duplicates)
  5. foreign import lib "SDL2.lib"
  6. } else {
  7. @(ignore_duplicates)
  8. foreign import lib "system:SDL2"
  9. }
  10. MAX_LOG_MESSAGE :: 4096
  11. LogCategory :: enum c.int {
  12. APPLICATION,
  13. ERROR,
  14. ASSERT,
  15. SYSTEM,
  16. AUDIO,
  17. VIDEO,
  18. RENDER,
  19. INPUT,
  20. TEST,
  21. /* Reserved for future SDL library use */
  22. RESERVED1,
  23. RESERVED2,
  24. RESERVED3,
  25. RESERVED4,
  26. RESERVED5,
  27. RESERVED6,
  28. RESERVED7,
  29. RESERVED8,
  30. RESERVED9,
  31. RESERVED10,
  32. /* Beyond this point is reserved for application use, e.g.
  33. enum {
  34. MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
  35. MYAPP_CATEGORY_AWESOME2,
  36. MYAPP_CATEGORY_AWESOME3,
  37. ...
  38. };
  39. */
  40. CUSTOM,
  41. }
  42. LogPriority :: enum c.int {
  43. DEFAULT = 0, // CUSTOM ONE
  44. VERBOSE = 1,
  45. DEBUG,
  46. INFO,
  47. WARN,
  48. ERROR,
  49. CRITICAL,
  50. NUM,
  51. }
  52. LogOutputFunction :: proc "c" (userdata: rawptr, category: LogCategory, priority: LogPriority, message: cstring)
  53. @(default_calling_convention="c", link_prefix="SDL_")
  54. foreign lib {
  55. LogSetAllPriority :: proc(priority: LogPriority) ---
  56. LogSetPriority :: proc(category: c.int, priority: LogPriority) ---
  57. LogGetPriority :: proc(category: c.int) -> LogPriority ---
  58. LogResetPriorities :: proc() ---
  59. Log :: proc(fmt: cstring, #c_vararg args: ..any) ---
  60. LogVerbose :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  61. LogDebug :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  62. LogInfo :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  63. LogWarn :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  64. LogError :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  65. LogCritical :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
  66. LogMessage :: proc(category: c.int, priority: LogPriority, fmt: cstring, #c_vararg args: ..any) ---
  67. // LogMessageV :: proc(category: c.int, priority: LogPriority, fmt: cstring, ap: va_list) ---
  68. LogGetOutputFunction :: proc(callback: ^LogOutputFunction, userdata: ^rawptr) ---
  69. LogSetOutputFunction :: proc(callback: LogOutputFunction, userdata: rawptr) ---
  70. }