Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
5.9 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_log.h
  20. *
  21. * Simple log messages with categories and priorities.
  22. *
  23. * By default logs are quiet, but if you're debugging SDL you might want:
  24. *
  25. * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
  26. *
  27. * Here's where the messages go on different platforms:
  28. * Windows: debug output stream
  29. * Android: log output
  30. * Others: standard error output (stderr)
  31. */
  32. #ifndef _SDL_log_h
  33. #define _SDL_log_h
  34. #include "SDL_stdinc.h"
  35. #include "begin_code.h"
  36. /* Set up for C function definitions, even when using C++ */
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /**
  41. * \brief The maximum size of a log message
  42. *
  43. * Messages longer than the maximum size will be truncated
  44. */
  45. #define SDL_MAX_LOG_MESSAGE 4096
  46. /**
  47. * \brief The predefined log categories
  48. *
  49. * By default the application category is enabled at the INFO level,
  50. * the assert category is enabled at the WARN level, test is enabled
  51. * at the VERBOSE level and all other categories are enabled at the
  52. * CRITICAL level.
  53. */
  54. enum
  55. {
  56. SDL_LOG_CATEGORY_APPLICATION,
  57. SDL_LOG_CATEGORY_ERROR,
  58. SDL_LOG_CATEGORY_ASSERT,
  59. SDL_LOG_CATEGORY_SYSTEM,
  60. SDL_LOG_CATEGORY_AUDIO,
  61. SDL_LOG_CATEGORY_VIDEO,
  62. SDL_LOG_CATEGORY_RENDER,
  63. SDL_LOG_CATEGORY_INPUT,
  64. SDL_LOG_CATEGORY_TEST,
  65. /* Reserved for future SDL library use */
  66. SDL_LOG_CATEGORY_RESERVED1,
  67. SDL_LOG_CATEGORY_RESERVED2,
  68. SDL_LOG_CATEGORY_RESERVED3,
  69. SDL_LOG_CATEGORY_RESERVED4,
  70. SDL_LOG_CATEGORY_RESERVED5,
  71. SDL_LOG_CATEGORY_RESERVED6,
  72. SDL_LOG_CATEGORY_RESERVED7,
  73. SDL_LOG_CATEGORY_RESERVED8,
  74. SDL_LOG_CATEGORY_RESERVED9,
  75. SDL_LOG_CATEGORY_RESERVED10,
  76. /* Beyond this point is reserved for application use, e.g.
  77. enum {
  78. MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
  79. MYAPP_CATEGORY_AWESOME2,
  80. MYAPP_CATEGORY_AWESOME3,
  81. ...
  82. };
  83. */
  84. SDL_LOG_CATEGORY_CUSTOM
  85. };
  86. /**
  87. * \brief The predefined log priorities
  88. */
  89. typedef enum
  90. {
  91. SDL_LOG_PRIORITY_VERBOSE = 1,
  92. SDL_LOG_PRIORITY_DEBUG,
  93. SDL_LOG_PRIORITY_INFO,
  94. SDL_LOG_PRIORITY_WARN,
  95. SDL_LOG_PRIORITY_ERROR,
  96. SDL_LOG_PRIORITY_CRITICAL,
  97. SDL_NUM_LOG_PRIORITIES
  98. } SDL_LogPriority;
  99. /**
  100. * \brief Set the priority of all log categories
  101. */
  102. extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
  103. /**
  104. * \brief Set the priority of a particular log category
  105. */
  106. extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
  107. SDL_LogPriority priority);
  108. /**
  109. * \brief Get the priority of a particular log category
  110. */
  111. extern DECLSPEC SDL_LogPriority SDLCALL SDL_LogGetPriority(int category);
  112. /**
  113. * \brief Reset all priorities to default.
  114. *
  115. * \note This is called in SDL_Quit().
  116. */
  117. extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
  118. /**
  119. * \brief Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO
  120. */
  121. extern DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
  122. /**
  123. * \brief Log a message with SDL_LOG_PRIORITY_VERBOSE
  124. */
  125. extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, const char *fmt, ...);
  126. /**
  127. * \brief Log a message with SDL_LOG_PRIORITY_DEBUG
  128. */
  129. extern DECLSPEC void SDLCALL SDL_LogDebug(int category, const char *fmt, ...);
  130. /**
  131. * \brief Log a message with SDL_LOG_PRIORITY_INFO
  132. */
  133. extern DECLSPEC void SDLCALL SDL_LogInfo(int category, const char *fmt, ...);
  134. /**
  135. * \brief Log a message with SDL_LOG_PRIORITY_WARN
  136. */
  137. extern DECLSPEC void SDLCALL SDL_LogWarn(int category, const char *fmt, ...);
  138. /**
  139. * \brief Log a message with SDL_LOG_PRIORITY_ERROR
  140. */
  141. extern DECLSPEC void SDLCALL SDL_LogError(int category, const char *fmt, ...);
  142. /**
  143. * \brief Log a message with SDL_LOG_PRIORITY_CRITICAL
  144. */
  145. extern DECLSPEC void SDLCALL SDL_LogCritical(int category, const char *fmt, ...);
  146. /**
  147. * \brief Log a message with the specified category and priority.
  148. */
  149. extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
  150. SDL_LogPriority priority,
  151. const char *fmt, ...);
  152. /**
  153. * \brief Log a message with the specified category and priority.
  154. */
  155. extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
  156. SDL_LogPriority priority,
  157. const char *fmt, va_list ap);
  158. /**
  159. * \brief The prototype for the log output function
  160. */
  161. typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
  162. /**
  163. * \brief Get the current log output function.
  164. */
  165. extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *callback, void **userdata);
  166. /**
  167. * \brief This function allows you to replace the default log output
  168. * function with one of your own.
  169. */
  170. extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction callback, void *userdata);
  171. /* Ends C function definitions when using C++ */
  172. #ifdef __cplusplus
  173. }
  174. #endif
  175. #include "close_code.h"
  176. #endif /* _SDL_log_h */
  177. /* vi: set ts=4 sw=4 expandtab: */