4 The GFXprim library includes a debug message infrastructure in order to ease
7 Many places of the library uses debug messages to report warnings, bugs, or
8 generally important events (i.e. context has been allocated, filter function
11 Debug messages are printed into the stderr and could be redirected to custom
14 The verbosity of the messages could be changed by the debug level. The debug
15 level is an unsigned integer (by default set to '0') and only messages that have
16 debug level lower or equal to debug level are printed.
18 There are few special debug message types with negative debug level (that
19 means that they are always printed), and as so these are used on various error
20 conditions, see bellow for more information.
23 -------------------------------------------------------------------------------
24 #include <core/GP_Debug.h>
28 void GP_SetDebugLevel(unsigned int level);
30 unsigned int GP_GetDebugLevel(void);
31 -------------------------------------------------------------------------------
33 Sets or gets library debug level. The default level is '0' at which only
34 'FATAL', 'BUG', 'WARNING', 'TODO' and messages with debug level '0' are shown.
36 Increasing this number would cause the library to be more verbose in debugging
39 Setting debug level to '1' would expose debug messages when object was created
40 or destroyed or when particular algorithm has been started.
42 Setting debug level to value higher than '1' would expose even more verbose
43 messages the current maximum used by debug messages is '4'.
45 The debug level may also be set by setting the 'GP_DEBUG' environment
46 variable. In such case the debug level is set accordingly to its value when
47 first debug message is about to be printed.
50 -------------------------------------------------------------------------------
51 #include <core/GP_Debug.h>
65 void GP_DebugPrint(int level, const char *file, const char *function, int line,
66 const char *fmt, ...);
67 -------------------------------------------------------------------------------
69 Printf-like macros used to print debug messages. All of them calls the
70 'GP_DebugPrint()' function with slightly different parameters.
73 -------------------------------------------------------------------------------
82 * Custom debug message handler structure.
93 * Sets custom debug message handler.
95 * If NULL is passed, custom handler is disabled and debug messages are printed
98 void GP_SetDebugHandler(void (*handler)(const struct GP_DebugMsg *msg));
100 -------------------------------------------------------------------------------
102 By default debug messages are printed into the 'stderr' you can redirect them
103 to your debug handler by this function.
105 NOTE: For more information see debug message handler
106 link:example_debug_handler.html[example].