![]() |
![]() |
![]() |
libMirage Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <mirage.h> enum MIRAGE_DebugMasks; #define MIRAGE_DEBUG (obj, lvl, ...) struct MIRAGE_DebugContext; gboolean mirage_debug_context_set_debug_mask (MIRAGE_DebugContext *self
,gint debug_mask
,GError **error
); gboolean mirage_debug_context_get_debug_mask (MIRAGE_DebugContext *self
,gint *debug_mask
,GError **error
); gboolean mirage_debug_context_set_domain (MIRAGE_DebugContext *self
,const gchar *domain
,GError **error
); gboolean mirage_debug_context_get_domain (MIRAGE_DebugContext *self
,const gchar **domain
,GError **error
); gboolean mirage_debug_context_set_name (MIRAGE_DebugContext *self
,const gchar *name
,GError **error
); gboolean mirage_debug_context_get_name (MIRAGE_DebugContext *self
,const gchar **name
,GError **error
);
libMirage supports changing of debug message verbosity on fly, without the need to restart the application. To achieve this, MIRAGE_DebugContext objects are used.
As implied by its name, the object itself is a context that can be attached to any object that is derived from MIRAGE_Object. It stores a name string, debug name string and integer value representing debug mask. The idea behind debug context is to have a container object that a MIRAGE_Object can pass to its children. This way, when debug context's debug mask is changed, the change is automatically propagated to the children as well, because they all share the same context.
It should be noted that a MIRAGE_DebugContext object is just a container providing name and debug mask, while the actual debug message functionality is implemented by a MIRAGE_Object.
typedef enum { /* Debug types */ MIRAGE_DEBUG_ERROR = 0x00F1, MIRAGE_DEBUG_WARNING = 0x00F2, /* Debug masks */ MIRAGE_DEBUG_PARSER = 0x0001, MIRAGE_DEBUG_DISC = 0x0002, MIRAGE_DEBUG_SESSION = 0x0004, MIRAGE_DEBUG_TRACK = 0x0008, MIRAGE_DEBUG_SECTOR = 0x0010, MIRAGE_DEBUG_FRAGMENT = 0x0020, MIRAGE_DEBUG_CDTEXT = 0x0040, } MIRAGE_DebugMasks;
Debug message types and debug masks used to control verbosity of various parts of libMirage.
All masks except MIRAGE_DEBUG_ERROR
and MIRAGE_DEBUG_WARNING
can be combined
together to control verbosity of libMirage.
error message | |
warning message | |
message belonging to parser | |
message belonging to disc | |
message belonging to session | |
message belonging to track | |
message belonging to sector | |
message belonging to fragment | |
message belonging to CD-TEXT encoder/decoder |
#define MIRAGE_DEBUG(obj, lvl, msg...)
Debugging macro, provided for convenience. It performs cast to MIRAGE_Object
on obj
, then calls mirage_object_debug_message()
with debug level lvl
and
debug message msg
....
|
object |
|
debug level |
|
debug message |
struct MIRAGE_DebugContext;
Contains private data only, and should be accessed using the functions below.
gboolean mirage_debug_context_set_debug_mask (MIRAGE_DebugContext *self
,gint debug_mask
,GError **error
);
Sets debug context's debug mask.
|
a MIRAGE_DebugContext |
|
debug mask |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |
gboolean mirage_debug_context_get_debug_mask (MIRAGE_DebugContext *self
,gint *debug_mask
,GError **error
);
Retrieves debug context's debug mask.
|
a MIRAGE_DebugContext |
|
location to store debug mask |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |
gboolean mirage_debug_context_set_domain (MIRAGE_DebugContext *self
,const gchar *domain
,GError **error
);
Sets debug context's domain name to domain
.
|
a MIRAGE_DebugContext |
|
domain name |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |
gboolean mirage_debug_context_get_domain (MIRAGE_DebugContext *self
,const gchar **domain
,GError **error
);
Retrieves debug context's domain name.
Pointer to buffer containing the domain name is stored into domain
; buffer
belongs to the object and therefore should not be modified.
|
a MIRAGE_DebugContext |
|
location to store pointer to domain name buffer |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |
gboolean mirage_debug_context_set_name (MIRAGE_DebugContext *self
,const gchar *name
,GError **error
);
Sets debug context's name to name
.
|
a MIRAGE_DebugContext |
|
name |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |
gboolean mirage_debug_context_get_name (MIRAGE_DebugContext *self
,const gchar **name
,GError **error
);
Retrieves debug context's name.
Pointer to buffer containing the name is stored into name
; buffer
belongs to the object and therefore should not be modified.
|
a MIRAGE_DebugContext |
|
location to store pointer to name buffer |
|
location to store error, or NULL
|
Returns : |
TRUE on success, FALSE on failure |