Common debug support

Common debug support — API to activate debugging messages from telepathy-glib

Synopsis


#include <telepathy-glib/debug.h>


void                tp_debug_set_flags                  (const gchar *flags_string);
void                tp_debug_set_persistent             (gboolean persistent);

void                tp_debug_set_flags_from_string      (const gchar *flags_string);
void                tp_debug_set_flags_from_env         (const gchar *var);
void                tp_debug_set_all_flags              (void);

Description

telepathy-glib has an internal mechanism for debug messages and filtering. Connection managers written with telepathy-glib are expected to connect this to their own debugging mechanisms: when the CM's debugging mechanism is activated, it should call tp_debug_set_flags_from_string(), tp_debug_set_flags_from_env() or tp_debug_set_all_flags().

The supported debug-mode keywords are subject to change, but currently include:

  • connection - output debug messages regarding TpBaseConnection
  • im - output debug messages regarding (text) instant messaging
  • properties - output debug messages regarding TpPropertiesMixin
  • params - output debug messages regarding connection manager parameters
  • all - all of the above

Details

tp_debug_set_flags ()

void                tp_debug_set_flags                  (const gchar *flags_string);

Set the debug flags indicated by flags_string, in addition to any already set.

The parsing matches that of g_parse_debug_string().

If telepathy-glib was compiled with --disable-debug (not recommended), this function does nothing.

since 0.6.1

flags_string :

The flags to set, comma-separated. If NULL or empty, no additional flags are set.

tp_debug_set_persistent ()

void                tp_debug_set_persistent             (gboolean persistent);

Used to enable persistent operation of the connection manager process for debugging purposes.

If telepathy-glib was compiled with --disable-debug (not recommended), this function does nothing.

persistent :

TRUE prevents the connection manager mainloop from exiting, FALSE enables exiting if there are no connections (the default behavior).

tp_debug_set_flags_from_string ()

void                tp_debug_set_flags_from_string      (const gchar *flags_string);

Set the debug flags indicated by flags_string, in addition to any already set. Unlike tp_debug_set_flags(), this enables persistence like tp_debug_set_persistent() if the "persist" flag is present or the string is "all" - this turns out to be unhelpful, as persistence should be orthogonal.

The parsing matches that of g_parse_debug_string().

If telepathy-glib was compiled with --disable-debug (not recommended), this function does nothing.

deprecated since 0.6.1. Use tp_debug_set_flags() and tp_debug_set_persistent() instead

flags_string :

The flags to set, comma-separated. If NULL or empty, no additional flags are set.

tp_debug_set_flags_from_env ()

void                tp_debug_set_flags_from_env         (const gchar *var);

Equivalent to tp_debug_set_flags_from_string (g_getenv (var)), and has the same problem with persistence being included in "all".

If telepathy-glib was compiled with --disable-debug (not recommended), this function does nothing.

deprecated since 0.6.1. Use tp_debug_set_flags(g_getenv(...)) and tp_debug_set_persistent() instead

var :

The name of the environment variable to parse

tp_debug_set_all_flags ()

void                tp_debug_set_all_flags              (void);

Activate all possible debug modes. This also activates persistent mode, which should have been orthogonal.

If telepathy-glib was compiled with --disable-debug (not recommended), this function does nothing.

deprecated since 0.6.1. Use tp_debug_set_flags ("all") and tp_debug_set_persistent() instead.