## camel-debug

camel-debug

## Synopsis

    #define             CAMEL_DEBUG_IMAP
    #define             CAMEL_DEBUG_IMAP_FOLDER
    void                camel_debug_init                    (void);
    gboolean            camel_debug                         (const gchar *mode);
    gboolean            camel_debug_start                   (const gchar *mode);
    void                camel_debug_end                     (void);
    #define             CAMEL_CHECK_GERROR                  (object,
                                                             method,
                                                             expr,
                                                             error)
    #define             camel_pointer_tracker_track         (ptr)
    void                camel_pointer_tracker_track_with_info
                                                            (gpointer ptr,
                                                             const gchar *info);
    void                camel_pointer_tracker_untrack       (gpointer ptr);
    void                camel_pointer_tracker_dump          (void);

## Description

## Details

### CAMEL_DEBUG_IMAP

    #define CAMEL_DEBUG_IMAP "imap"

### CAMEL_DEBUG_IMAP_FOLDER

    #define CAMEL_DEBUG_IMAP_FOLDER "imap:folder"

### camel_debug_init ()

    void                camel_debug_init                    (void);

Init camel debug.

CAMEL_DEBUG is set to a comma separated list of modules to debug. The modules can contain module-specific specifiers after a ':', or just act as a wildcard for the module or even specifier. e.g. 'imap' for imap debug, or 'imap:folder' for imap folder debug. Additionaly, ':folder' can be used for a wildcard for any folder operations.

### camel_debug ()

    gboolean            camel_debug                         (const gchar *mode);

Check to see if a debug mode is activated. `mode` takes one of two forms, a fully qualified 'module:target', or a wildcard 'module' name. It returns a boolean to indicate if the module or module and target is currently activated for debug output.

### camel_debug_start ()

    gboolean            camel_debug_start                   (const gchar *mode);

Start debug output for a given mode, used to make sure debug output is output atomically and not interspersed with unrelated stuff.

Returns : | Returns true if mode is set, and in which case, you must call debug_end when finished any screen output.

### camel_debug_end ()

    void                camel_debug_end                     (void);

Call this when you're done with your debug output. If and only if you called camel_debug_start, and if it returns TRUE.

### CAMEL_CHECK_GERROR()

    #define             CAMEL_CHECK_GERROR(object, method, expr, error)

This sanity checks return values and GErrors. If returning failure, make sure the GError is set. If returning success, make sure the GError is NOT set.

Example:

success = class->foo (object, some_data, error); CAMEL_CHECK_GERROR (object, foo, success, error); return success;

Since 2.32

### camel_pointer_tracker_track()

    #define             camel_pointer_tracker_track(ptr)

Adds pointer 'ptr' to pointer tracker. Usual use case is to add object to the tracker in GObject::init and remove it from tracker within GObject::finalize. Since the tracker's functions are called, the application prints summary of the pointers on console on exit. If everything gone right then it prints message about all tracked pointers were removed. Otherwise it prints summary of left pointers in the tracker. Added pointer should be removed with pair function `camel_pointer_tracker_untrack()`.

See `camel_pointer_tracker_dump()`, `camel_pointer_tracker_track_with_info()`.

`ptr` : | pointer to add to pointer tracker

Since 3.6

### camel_pointer_tracker_track_with_info ()

    void                camel_pointer_tracker_track_with_info
                                                            (gpointer ptr,
                                                             const gchar *info);

Adds pointer to the pointer tracker, with associated information, which is printed in summary of pointer tracker printed by `camel_pointer_tracker_dump()`. For convenience can be used `camel_pointer_tracker_track()`, which adds place of the caller as `info`. Added pointer should be removed with pair function `camel_pointer_tracker_untrack()`.

`ptr` : | pointer to add to the pointer tracker
`info` : | info to print in tracker summary

Since 3.6

### camel_pointer_tracker_untrack ()

    void                camel_pointer_tracker_untrack       (gpointer ptr);

Removes pointer from the pointer tracker. It's an error to try to remove pointer which was not added to the tracker by `camel_pointer_tracker_track()` or `camel_pointer_tracker_track_with_info()`, or a pointer which was already removed.

`ptr` : | pointer to remove from the tracker

Since 3.6

### camel_pointer_tracker_dump ()

    void                camel_pointer_tracker_dump          (void);

Prints information about currently stored pointers in the pointer tracker. This is called automatically on application exit if `camel_pointer_tracker_track()` or `camel_pointer_tracker_track_with_info()` was called.

Note: If the library is configured with --enable-backtraces, then also backtraces where the pointer was added is printed in the summary.

Since 3.6