ftlogging.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /****************************************************************************
  2. *
  3. * ftlogging.h
  4. *
  5. * Additional debugging APIs.
  6. *
  7. * Copyright (C) 2020-2023 by
  8. * David Turner, Robert Wilhelm, and Werner Lemberg.
  9. *
  10. * This file is part of the FreeType project, and may only be used,
  11. * modified, and distributed under the terms of the FreeType project
  12. * license, LICENSE.TXT. By continuing to use, modify, or distribute
  13. * this file you indicate that you have read the license and
  14. * understand and accept it fully.
  15. *
  16. */
  17. #ifndef FTLOGGING_H_
  18. #define FTLOGGING_H_
  19. #include <ft2build.h>
  20. #include FT_CONFIG_CONFIG_H
  21. FT_BEGIN_HEADER
  22. /**************************************************************************
  23. *
  24. * @section:
  25. * debugging_apis
  26. *
  27. * @title:
  28. * External Debugging APIs
  29. *
  30. * @abstract:
  31. * Public APIs to control the `FT_DEBUG_LOGGING` macro.
  32. *
  33. * @description:
  34. * This section contains the declarations of public functions that
  35. * enables fine control of what the `FT_DEBUG_LOGGING` macro outputs.
  36. *
  37. */
  38. /**************************************************************************
  39. *
  40. * @function:
  41. * FT_Trace_Set_Level
  42. *
  43. * @description:
  44. * Change the levels of tracing components of FreeType at run time.
  45. *
  46. * @input:
  47. * tracing_level ::
  48. * New tracing value.
  49. *
  50. * @example:
  51. * The following call makes FreeType trace everything but the 'memory'
  52. * component.
  53. *
  54. * ```
  55. * FT_Trace_Set_Level( "any:7 memory:0 );
  56. * ```
  57. *
  58. * @note:
  59. * This function does nothing if compilation option `FT_DEBUG_LOGGING`
  60. * isn't set.
  61. *
  62. * @since:
  63. * 2.11
  64. *
  65. */
  66. FT_EXPORT( void )
  67. FT_Trace_Set_Level( const char* tracing_level );
  68. /**************************************************************************
  69. *
  70. * @function:
  71. * FT_Trace_Set_Default_Level
  72. *
  73. * @description:
  74. * Reset tracing value of FreeType's components to the default value
  75. * (i.e., to the value of the `FT2_DEBUG` environment value or to NULL
  76. * if `FT2_DEBUG` is not set).
  77. *
  78. * @note:
  79. * This function does nothing if compilation option `FT_DEBUG_LOGGING`
  80. * isn't set.
  81. *
  82. * @since:
  83. * 2.11
  84. *
  85. */
  86. FT_EXPORT( void )
  87. FT_Trace_Set_Default_Level( void );
  88. /**************************************************************************
  89. *
  90. * @functype:
  91. * FT_Custom_Log_Handler
  92. *
  93. * @description:
  94. * A function typedef that is used to handle the logging of tracing and
  95. * debug messages on a file system.
  96. *
  97. * @input:
  98. * ft_component ::
  99. * The name of `FT_COMPONENT` from which the current debug or error
  100. * message is produced.
  101. *
  102. * fmt ::
  103. * Actual debug or tracing message.
  104. *
  105. * args::
  106. * Arguments of debug or tracing messages.
  107. *
  108. * @since:
  109. * 2.11
  110. *
  111. */
  112. typedef void
  113. (*FT_Custom_Log_Handler)( const char* ft_component,
  114. const char* fmt,
  115. va_list args );
  116. /**************************************************************************
  117. *
  118. * @function:
  119. * FT_Set_Log_Handler
  120. *
  121. * @description:
  122. * A function to set a custom log handler.
  123. *
  124. * @input:
  125. * handler ::
  126. * New logging function.
  127. *
  128. * @note:
  129. * This function does nothing if compilation option `FT_DEBUG_LOGGING`
  130. * isn't set.
  131. *
  132. * @since:
  133. * 2.11
  134. *
  135. */
  136. FT_EXPORT( void )
  137. FT_Set_Log_Handler( FT_Custom_Log_Handler handler );
  138. /**************************************************************************
  139. *
  140. * @function:
  141. * FT_Set_Default_Log_Handler
  142. *
  143. * @description:
  144. * A function to undo the effect of @FT_Set_Log_Handler, resetting the
  145. * log handler to FreeType's built-in version.
  146. *
  147. * @note:
  148. * This function does nothing if compilation option `FT_DEBUG_LOGGING`
  149. * isn't set.
  150. *
  151. * @since:
  152. * 2.11
  153. *
  154. */
  155. FT_EXPORT( void )
  156. FT_Set_Default_Log_Handler( void );
  157. /* */
  158. FT_END_HEADER
  159. #endif /* FTLOGGING_H_ */
  160. /* END */